Python的md5sum等命令行工具的替代品。
项目描述
- 主页:
- 版权:
- 2016-2021 Antonio Valentino <antonio dot valentino at tiscali dot it>
用法
usage: hashsum [-h] [-a] [--tag] [-b | -t] [-c | -l] [--quiet]
[--status] [--strict] [-w] [-m] [--version]
[FILE [FILE ...]]
Compute and check message digest with different hash algorithms.
The sums are computed as described in [1].
When checking, the input should be a former output of this program.
The default mode is to print a line with checksum, a character
indicating input mode ('*' for binary, space for text), and name
for each FILE.
[1] https://docs.pythonlang.cn/3/library/hashlib.html
positional arguments:
FILE name of file to process. If not specified,
or set to -, data are read form the
standard input
optional arguments:
-h, --help show this help message and exit
-a , --algorithm specify the hashing algorithm
(default: 'md5')
--tag create a BSD-style checksum
-b, --binary read input data in binary mode
-t, --text read input data in text mode (default)
-c, --check read checksum(s) form FILE and check them
-l, --list-algorithms
list available hashing algorithms
-m, --multi-thread perform I/O and hash computation in separate threads
(default=False). Can speed-up computation on large
files while it is not recommended for small files.
--version show program's version number and exit
check:
Options that are useful only when verifying checksums
--quiet don't print OK for each successfully
verified file
--status don't output anything, status code shows
success
--strict exit non-zero for improperly formatted
checksum lines
-w, --warn warn about improperly formatted checksum
lines
包测试
测试包的推荐方法是使用 pytest
$ python3 -m pytest -v
========================== test session starts ==========================
platform linux -- Python 3.9.5, pytest-6.0.2, py-1.10.0, pluggy-0.13.0
hashsum version: 1.4.0.dev0
Platform: Linux-5.11.0-24-generic-x86_64-with-glibc2.33
Byte-ordering: little
Default encoding: utf-8
Default FS encoding: utf-8
Default locale: ('it_IT', 'UTF-8')
rootdir: /home/antonio/projects/hashsum, configfile: setup.cfg
plugins: hypothesis-5.43.3, remotedata-0.3.2, doctestplus-0.9.0,
openfiles-0.5.0, flake8-1.0.6, filter-subpackage-0.1.1, cov-2.10.1
collected 26 items
tests/test_hashsum.py::ComputeSumTestCase::test_binary PASSED [ 3%]
tests/test_hashsum.py::ComputeSumTestCase::test_binary_auto PASSED [ 7%]
[...]
tests/test_hashsum.py::ThreadedCheckTestCase::test_text PASSED [100%]
========================== 26 passed in 0.29s ===========================
请注意,一些基本系统信息(可用于错误报告)也会打印在屏幕上。
"pytest"的默认配置存储在源包根目录中的 setup.cfg 文件中
[tool:pytest] addopts = -p no:warnings -p no:logging
或者可以使用
$ python3 -m unittest -v tests/test_hashsum.py
许可协议
hashsum 软件根据“3-Clause BSD License”条款进行分发,详细信息请参阅 LICENSE.txt 文件。
hashsum 更新日志
hashsum v1.4.1 (2021/07/18)
修复了轮生成问题:生成的轮不是通用的,它们仅适用于Python 3.6及以上版本
hashsum v1.4.0 (2021/07/18)
放弃对Python < 3.6的支持。
切换到GitHub Actions进行持续集成。
修复Windows上文本模式下校验和的验证。
重构并简化测试代码。
添加构建系统支持(pyproject.toml)
切换到声明性设置配置(setup.cfg)。
hashsum v1.3.0(2019年8月25日)
将hashsum.VERSION重命名为hashsum.__version__
添加测试实用函数
推荐使用小写字母作为哈希函数名称
提高线程计算校验和时对未知/不可用哈希函数的鲁棒性
测试CLI中添加了新的–failfast选项
改进了基准测试脚本
更新了man页面
提高了与pytest的兼容性
hashsum v1.2.2(2016年11月15日)
修复与Windows操作系统的兼容性问题
hashsum v1.2.1(2016年8月24日)
微调打包修复
hashsum v1.2.0(2016年8月24日)
提高与OpenSSL命令行工具的兼容性
更好地迭代数据块
可选的线程哈希计算
重构:整个代码在tools中重新组织
删除所有与getcite>gettext相关的文件
hashsum v1.1.1(2016年1月30日)
将man页面包含在tarball中
hashsum v1.1(2016年1月30日)
修复IncrementalNewlineDecoder.decoder签名
在文本模式下读取时,始终使用final=True调用decode
将校验和计算代码进行分解
所有Exceptions现在都在main函数中捕获
添加单元测试
代码清理
添加NEWS.rst文件
添加man页面
改进命令行帮助(也修复了一些错误)
通过travis-ci启用自动测试
hashsum v1.0(2016年1月4日)
初始发布
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。
源分发
构建分发
hashsum-1.4.1.tar.gz的哈希
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 2c40505ab82578651f9875241c48d03a1149c36eabd858907b7f3ab047a8c5e7 |
|
| MD5 | 9f0c1d2fddaa98e0c7865db490459507 |
|
| BLAKE2b-256 | b52e755f43f8bac40b31976252ad86bf44118819822cab61de85b39e8e19bd45 |
hashsum-1.4.1-py3-none-any.whl的哈希
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 0092627a2ce2c444d8493ed11d24962b751e6b8c488ae231d7407a34305f94c3 |
|
| MD5 | 3e61bfffc74f4d00e90012e0d617cf00 |
|
| BLAKE2b-256 | c1b28969b68a3d22ffa4408d3f88070c7d0bed050ebb5cc9da2c2af8770c8087 |