liveBook · Manning

SHA-2

As explained in Real-World Cryptography

SHA-2 is a standardized family of cryptographic hash algorithms producing digests of 224, 256, 384, or 512 bits.

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

How Real-World Cryptography covers it

How deep it goes
Defines variants and sketches compression and Merkle–Damgård processing, stopping short of implementation-level detail.
Examples
Demonstrates SHA-224, SHA-256, SHA-384, and SHA-512 outputs for “hello world” using OpenSSL.
What it assumes
Assumes basic hash-function familiarity and teaches XOR before describing SHA-2’s simplified construction.
What you can do after
Operate SHA-2 variants through the OpenSSL command-line interface and distinguish their digest lengths.
How it connects
Connects SHA-2 to compression functions, XOR, Merkle–Damgård construction, SHA-3, and length-extension attacks.

Also explained in

Compare how 2 books explain SHA-2 →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Real-World Cryptography. The section links point to the parts of the book it draws on.