SHA-2 is a widely adopted family of cryptographic hash algorithms. Its variants produce 224-, 256-, 384-, or 512-bit digests; SHA-256 is common, while SHA-512 suits more cautious choices. section 2.5.1
The family includes these digest choices:
- SHA-224, SHA-256, SHA-384, and SHA-512 produce their named output lengths. section 2.5.1
- SHA-512/224 and SHA-512/256 truncate SHA-512 to 224 and 256 bits. section 2.5.1
- Internally, SHA-2 uses compression functions within the Merkle–Damgård construction: pad the message, split it into blocks, and process each block iteratively. section 2.5.1
Hashing “hello world” with OpenSSL
Run `echo -n "hello world" | openssl dgst -sha256` to produce a 256-bit digest. Switching to `-sha224`, `-sha384`, or `-sha512` changes both the digest length and the resulting value. section 2.5.1
Figure 2.6 SHA-2 and SHA-3, the two most widely adopted hash functions. SHA-2 is based on the Merkle–Damgård construction, while SHA-3 is based on the sponge construction.
Compare SHA-2’s Merkle–Damgård construction with SHA-3’s sponge construction. section 2.5

