项目作者: shash873

项目描述 :
Returns the MD5, SHA1, SHA256, SHA384, or SHA512 checksum of a file
高级语言: Python
项目地址: git://github.com/shash873/simple-file-checksum.git
创建时间: 2020-11-09T08:20:35Z
项目社区:https://github.com/shash873/simple-file-checksum

开源协议:Other

下载



Simple File Checksum Logo

Simple File Checksum

Returns the MD5, SHA1, SHA256, SHA384, or SHA512 checksum of a file



Tests Badge
License: MIT
Supported Platforms
PyPI Supported Versions
PyPI
PyPI Status
Downloads

Installation

Run the following to install:

  1. pip3 install simple-file-checksum

Usage

Python:

  1. >>> from simple_file_checksum import get_checksum
  2. >>> get_checksum("tst/file.txt")
  3. '9e107d9d372bb6826bd81d3542a419d6'
  4. >>> get_checksum("tst/file.txt", algorithm="MD5")
  5. '9e107d9d372bb6826bd81d3542a419d6'
  6. >>> get_checksum("tst/file.txt", algorithm="SHA1")
  7. '2fd4e1c67a2d28fced849ee1bb76e7391b93eb12'
  8. >>> get_checksum("tst/file.txt", algorithm="SHA256")
  9. 'd7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592'
  10. >>> get_checksum("tst/file.txt", algorithm="SHA384")
  11. 'ca737f1014a48f4c0b6dd43cb177b0afd9e5169367544c494011e3317dbf9a509cb1e5dc1e85a941bbee3d7f2afbc9b1'
  12. >>> get_checksum("tst/file.txt", algorithm="SHA512")
  13. '07e547d9586f6a73f73fbac0435ed76951218fb7d0c8d788a309d785436bbb642e93a252a954f23912547d1e8a3b5ed6e1bfd7097821233fa0538f3db854fee6'

Terminal:

  1. $ simple-file-checksum tst/file.txt
  2. 9e107d9d372bb6826bd81d3542a419d6
  3. $ simple-file-checksum tst/file.txt -a MD5
  4. 9e107d9d372bb6826bd81d3542a419d6
  5. $ simple-file-checksum tst/file.txt -a SHA1
  6. 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12
  7. $ simple-file-checksum tst/file.txt -a SHA256
  8. d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592
  9. $ simple-file-checksum tst/file.txt -a SHA384
  10. ca737f1014a48f4c0b6dd43cb177b0afd9e5169367544c494011e3317dbf9a509cb1e5dc1e85a941bbee3d7f2afbc9b1
  11. $ simple-file-checksum tst/file.txt -a SHA512
  12. 07e547d9586f6a73f73fbac0435ed76951218fb7d0c8d788a309d785436bbb642e93a252a954f23912547d1e8a3b5ed6e1bfd7097821233fa0538f3db854fee6

Developing

To install simple-file-checksum, along with the tools you need to develop and run tests, run the following:

  1. pip3 install -e ".[dev]"