SHA-224 (source code)
= SHA-224
{c}
{title2=$H(m)\in\{0,1\}^{224}$}
\b[SHA-224] is a <SHA-2> <cryptographic hash function> producing a 224-bit digest. It follows the <SHA-256> computation with a different <hash initialization vector> and a final output shortened to its first seven 32-bit state words.<Secure Hash Standard by National Institute of Standards and Technology>[§5.3.2 and §6.3]{ref}
If the final state words are $H_0,\ldots,H_7$, the digest is
$$
H_0\Vert H_1\Vert\cdots\Vert H_6.
$$
This is $7\times32=224$ bits, or 28 bytes and 56 <hexadecimal> digits. The input is still padded into 512-bit blocks, and each block still undergoes the SHA-256 family's 64-round computation. Output width and internal processing width are different quantities.
For a computed example, the ASCII bytes `61 62 63` give
`23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7`.
A <SHA-256> digest of the same bytes begins `ba7816bf8f01cfea`. Keeping only its first 28 bytes therefore does not give SHA-224. The algorithm's different initial values are applied before processing any message block.
The same output length also does not make SHA-224 identical to <SHA-512 224>. The latter uses the 64-bit SHA-512 family structure, a different initial state and a different padding/length-field convention. For instance, a 56-byte input takes two padded blocks in SHA-224 but only one in the SHA-512-based variant. Both results have 28 bytes, so a digest field's size cannot identify which function produced it.
The intended <cryptographic protocol> must select the hash explicitly. A <cryptographic test vector> for SHA-224 checks that defined function, whereas an <HMAC> vector also specifies its key and keyed construction.
Back to article page