SHA Message Digest The Secure Hash Algorithm (SHA) is a family of cryptographic hash functions certified by FIPS. It computes a fixed-length string (also known as a message digest) from a given digital message, with a very high probability that different messages will produce different strings.
1. Introduction to SHA SHA currently has four algorithm versions: SHA-0, SHA-1, SHA-2, and SHA-3. The most widely used today is SHA-2.
SHA function comparison Algorithm and variant Output hash value length
(bits) Intermediate hash value length
(bits) Block size
(bits) Maximum input message length
(bits) Number of rounds Operations used Collision attack
(bits) Performance example[3]
(MiB/s) MD5(for reference) 128 128
(4 × 32) 512 Unlimited[4] 64 And, Xor, Rot, Add (mod 232), Or ≤18
(collision found) 335 SHA-0 160 160
(5 × 32) 512 264 − 1 80 And, Xor, Rot, Add (mod 232), Or <34
(collision found) - SHA-1 160 160
(5 × 32) 512 264 − 1 80 <63[5]
(collision found[6]) 192 SHA-2 SHA-224
SHA-256 224
256 256
(8 × 32) 512 264 − 1 64 And, Xor, Rot, Add (mod 232), Or, Shr 112 128 139 SHA-384
SHA-512
SHA-512/224
SHA-512/256 384
512
224 256 512
(8 × 64) 1024 2128 − 1 80 And, Xor, Rot, Add (mod 264), Or, Shr 192
256
112
128 154 SHA-3 SHA3-224
SHA3-256
SHA3-384
SHA3-512 224
256
384
512 1600
(5 × 5 × 64) 1152
1088
832
576 Unlimited[7] 24[8] And, Xor, Rot, Not 112
128
192
256 - SHAKE128
SHAKE256 d (arbitrary)
d (arbitrary) 1344
1088 min(d/2, 128)
min(d/2, 256) - Since the various SHA-2 algorithm variants differ only slightly in digest length, number of rounds, and other minor details while sharing the same basic structure, and since there are many detailed explanations of SHA-256 available online, we will use SHA-256 as our working example here.
...