SHA-384 (source code)
= SHA-384
{c}
{title2=$H(m)\in\{0,1\}^{384}$}
\b[SHA-384] is a <SHA-2> <cryptographic hash function> producing 384 bits. It uses the 64-bit word operations, 1024-bit blocks and eighty-round computation of <SHA-512>, with its own <hash initialization vector>. Its result is the first 384 bits of that differently initialized computation.<Secure Hash Standard by National Institute of Standards and Technology>[§5.3.4 and §6.5]{ref}
Write its final eight-word state as $H_0,\ldots,H_7$, with each word containing 64 bits. The output is
$$
H_0\Vert H_1\Vert H_2\Vert H_3\Vert H_4\Vert H_5,
$$
where $\Vert$ denotes <concatenation>. Six words give $6\times64=384$ bits, or 48 bytes and 96 <hexadecimal> digits. The computation still maintains eight state words while processing the message; the shorter output does not reduce every intermediate state to six words.
For a computed example using ASCII bytes `61 62 63`, SHA-384 gives
`cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7`.
The ordinary <SHA-512> digest begins `ddaf35a193617aba`, so truncating that digest to 48 bytes already disagrees at the beginning. Different initialization, rather than merely a shorter printed result, distinguishes the algorithms.
A streaming implementation can process message blocks using the SHA-512 family machinery while retaining the selected variant's initial state and final serialization. Treating those choices as part of the function is essential when a <digital signature> or <HMAC> specification names SHA-384. Changing to another 384-bit output transformation changes the algorithm, even if the receiving buffer still has the expected size.
Back to article page