问题: 要在MAC OS中获取文件的sha1sum值,请运行以下命令
sha1sum file_name
我得到的错误是
perl version 5.18.2 can't run /usr/bin/sha1sum. Try the alternative(s):
/usr/bin/sha1sum5.16 (uses perl 5.16)
Run "man perl" for more information about multiple version support in
Mac OS X.
我尝试安装 textutils和coreutils ,但都失败了。任何人都可以建议我如何解决这个问题?提前谢谢。
答案 0 :(得分:34)
您可以使用带有brew install md5sha1sum
的自制程序在Mac OS中安装它。从此链接https://raamdev.com/2008/howto-install-md5sum-sha1sum-on-mac-os-x/
答案 1 :(得分:0)
MacOS预先安装了var controller = new Leap.Controller();
controller.use('playback', {recording: 'demo.json'}).connect()
,默认情况下会计算shasum
:
sha1
用法示例:
$ shasum --help
Usage: shasum [OPTION]... [FILE]...
Print or check SHA checksums.
With no FILE, or when FILE is -, read standard input.
-a, --algorithm 1 (default), 224, 256, 384, 512, 512224, 512256
[...]
$ "test" | shasum
da39a3ee5e6b4b0d3255bfef95601890afd80709 -
也会做:
openssl sha1
答案 2 :(得分:0)
您可以使用shasum或openssl来计算哈希值
echo -n "yourpassword" | openssl sha1
b48cf0140bea12734db05ebcdb012f1d265bed84
echo -n "yourpassword" | shasum
b48cf0140bea12734db05ebcdb012f1d265bed84