SHA is a series of encrypting algorithm which includes sha1, sha256, sha512 and so on.
They calculate a checksum based on a file or text string. We can use the result to judge whether two objects are the same.
There is a terminal tool called shasum on Unix style operating system.
Some usage information will show if we enter shasum –help on terminal.
Here are simple examples show how to use it.
Calculate the sha256 checksum of a text string.
$ echo -n "hello world" |shasum -a 256 b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9 -
Calculate the sha256 checksum of a file.
$ shasum -a 256 txt c1d234dcdd429adb6c25985b7d9e52ea101b4f13ab41ad8406da0b78ee2f41dc txt