How to install sha1sum on mac?

Problem: To get the value of the sha1sum file on MAC OS, run the following command

sha1sum file_name 

The error I received is as follows

 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. 

I tried installing textutils and coreutils , but both failed. Can someone suggest me how can I solve the problem? Thanks in advance.

+16
source share
2 answers

You can install it on Mac OS using homebrew with brew install md5sha1sum . Got information at this link https://raamdev.com/2008/howto-install-md5sum-sha1sum-on-mac-os-x/

+35
source

On macOS, shasum installed, which by default calculates the sum of 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 [...] 

Usage example:

 $ "test" | shasum da39a3ee5e6b4b0d3255bfef95601890afd80709 - 

Also openssl sha1 does the job:

 $ "test" | openssl sha1 da39a3ee5e6b4b0d3255bfef95601890afd80709 
0
source

Source: https://habr.com/ru/post/982409/


All Articles