用于计算校验和的简单命令行实用程序。
hb的Python项目详细描述
散列布朗
用于计算校验和的简单命令行实用程序。
安装
pip install hb
用法
计算文件的sha1:
$ hb -a sha1 hello.txt
sha1 (hello.txt) = 493a253abf93d705d67edeb463134a5c8752fc9d
检查文件是否与给定的校验和匹配:
$ hb -a md5 hello.txt -g 77060c267470021a97392b815138733e
md5 (hello.txt) = 77060c267470021a97392b815138733e OK
$ hb -a md5 hello.txt -g 0123456789abcdef
md5 (hello.txt) = 0123456789abcdef BAD
可以从文件中读取校验和:
$ hb -c checksums.txt
sha512 (hello.txt) = 493a253abf93d705d67edeb463134a5c8752fc9d OK
sha512 (world.txt) = 683e4ee04e75e71a6dca42807001f00be1fcb2a3 OK
sha512 (image.jpg) = f3a53e6c2743645f08faedadd7a2c57cbc38632f OK
sha512 (video.mp4) = 03ba9191fc4cd74f218df58542643fbc07dca532 OK
hash brown以bsd样式输出其结果。校验和文件也是bsd样式的。
所有文件都以二进制模式读取。
globbing和递归globbing分别通过*
和**
支持。
全局处理时不包括点文件,需要显式指定。
选项
-a, --algorithm [blake2b|blake2s|md5|sha1|sha224|sha256|sha384|sha512|adler32|crc32]
-c, --check Read checksums from a file.
-g, --given TEXT See if the given checksum `TEXT` matches the
computed checksum. (use with -a)
-p, --parallel Process files in parallel.
-q, --quiet Hide results that are OK. (use with -c)
-t, --timer Display elapsed time in seconds.
--version Show the version and exit.
-h, --help Show this message and exit.