SHA Hash Generation Tool

What is SHA?

SHA (Secure Hash Algorithm) is a series of hash functions designed by the US National Security Agency (NSA). SHA-1 generates a 160-bit (20-byte) hash value, SHA-256 generates a 256-bit (32-byte) hash value, and SHA-512 generates a 512-bit (64-byte) hash value.

SHA hash functions always produce the same hash value for the same input. However, for slightly different inputs, they generate a completely different hash value. This is a characteristic called the "avalanche effect".

From a security perspective, SHA-1 is now deprecated, but SHA-256 and SHA-512 are still considered secure. They are used in various security applications such as digital signatures, message authentication codes, and password hashing.

For example, the SHA-256 hash value for the string "Hello, World!" is dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f.

How to execute with Linux command

In Linux, you can use the sha1sum, sha256sum, and sha512sum commands to generate SHA-1, SHA-256, and SHA-512 hashes, respectively.

Example of generating an SHA-1 hash:
echo -n "Hello, World!" | sha1sum
Result: 0a0a9f2a6772942557ab5355d76af442f8f65e01 -

Example of generating an SHA-256 hash:
echo -n "Hello, World!" | sha256sum
Result: dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f -

Example of generating an SHA-512 hash:
echo -n "Hello, World!" | sha512sum
Result: 374d794a95cdcfd8b35993185fef9ba368f160d8daf432d08ba9f1ed1e5abe6cc69291e0fa2fe0006a52570ef18c19def4e617c33ce52ef0a6e5fbe318cb0387 -

Example of generating an SHA-256 hash of a file:
sha256sum filename
Result: hash_value filename

Example of generating SHA-256 hashes of multiple files at once:
sha256sum file1 file2 file3

Example of verifying a hash value:
sha256sum -c hash_list_file
*The hash list file should be in the format "hash_value filename".