Skip to main content

What Is SHA-384?

SHA-384 is a cryptographic hash function from the SHA-2 family. It processes data of arbitrary length and produces a hash value with a fixed length of 384 bits.

That corresponds to:

  • 48 bytes
  • 96 hexadecimal characters

SHA-384 is closely related to SHA-512. Both algorithms use the same basic 64-bit structure, process messages in 1024-bit blocks, and perform 80 compression rounds for each block.

Nevertheless, SHA-384 is not simply a SHA-512 hash with the last 128 bits removed.

As with SHA-224 and SHA-256, the difference begins before the first compression round: SHA-384 uses its own initial hash values.

SHA-384 Belongs to the SHA-2 Family​

SHA-2 is not a single hash function, but a family of several related algorithms:

  • SHA-224
  • SHA-256
  • SHA-384
  • SHA-512
  • SHA-512/224
  • SHA-512/256

In What Is SHA-2?, we saw that these algorithms can be roughly divided into two groups.

SHA-224 and SHA-256 work with 32-bit words and 512-bit message blocks.

SHA-384 and SHA-512, as well as SHA-512/224 and SHA-512/256, by contrast, use 64-bit words and 1024-bit message blocks.

That makes SHA-384 internally much more closely related to SHA-512 than to SHA-256.

How Long Is a SHA-384 Hash?​

A SHA-384 hash always has:

384 bits

That is:

48 bytes

In hexadecimal representation, four bits are represented by one character. A SHA-384 hash therefore consists of:

384 / 4 = 96

hexadecimal characters.

The size of the input doesn't change that.

A short text and a large file both produce a SHA-384 hash of exactly 384 bits.

How Does SHA-384 Work?​

The basic structure largely corresponds to SHA-512.

SHA-384 uses:

PropertySHA-384
Hash length384 bits
Word size64 bits
Block size1024 bits
Message schedule80 words
Rounds per block80

In simplified terms, the calculation proceeds as follows:

  1. The message is padded.
  2. The prepared message is divided into 1024-bit blocks.
  3. Each block begins with sixteen 64-bit words.
  4. From these, a message schedule with a total of 80 words is generated.
  5. The compression function processes the block over 80 rounds.
  6. The internal hash state is updated.
  7. From the final state, 384 bits are output as the hash value.

If this process seems familiar, that's because SHA-384 and SHA-512 use the same basic 64-bit structure.

Is SHA-384 Simply a Truncated SHA-512 Hash?​

No.

You might initially assume that SHA-384 works roughly like this:

SHA-512
↓
512-bit hash
↓
remove the last 128 bits
↓
384-bit hash

That would be a simple truncation of SHA-512.

SHA-384 works differently, however.

SHA-384 and SHA-512 do use the same basic compression function, but begin their calculations with different initial hash values.

The internal state is therefore already different before the first message block is processed.

For the same message, the following therefore generally applies:

SHA-384(message)
≠
first 384 bits of SHA-512(message)

At the end, the output of SHA-384 does consist of the first six 64-bit words of the final internal state. But this state was calculated with the SHA-384-specific initial hash values.

The Initial Hash Values Make the Difference​

Both SHA-384 and SHA-512 work internally with eight 64-bit words as their hash state.

The Secure Hash Standard, however, defines its own initial hash values for SHA-384.

In simplified form, the difference looks like this:

Message
│
▼
Padding / blocks
│
┌─────────────┴─────────────┐
│ │
SHA-384 SHA-512
│ │
SHA-384 initial values SHA-512 initial values
│ │
▼ ▼
80 rounds 80 rounds
│ │
▼ ▼
different internal different internal
state state
│ │
▼ ▼
384 bits 512 bits

So the two algorithms use largely the same machine, but start it from different states.

This is the same basic idea we already saw with SHA-224 and SHA-256.

Try Out the Difference Yourself​

This difference, too, can be made directly visible.

Enter any text. The tool calculates from it:

  • the SHA-384 hash,
  • the SHA-512 hash,
  • and the first 384 bits of the SHA-512 hash.

That lets you compare SHA-384 directly with a SHA-512 hash truncated to 384 bits.

Compare SHA-384 and SHA-512

Is SHA-384 just a SHA-512 hash with the last 128 bits missing? Try it with your own text.

0 characters, 0 UTF-8 bytes

This implementation is for illustration. For production cryptography, vetted cryptographic libraries should be used.

Both comparison values are exactly 384 bits long. Nevertheless, they differ for your input.

The tool can additionally show how many of the 384 bits differ. This number only describes the difference for this specific input and is not a measure of cryptographic security.

What matters is the cause: SHA-384 begins the calculation with different initial hash values than SHA-512.

SHA-384 and SHA-512 Compared​

The two algorithms have very many things in common:

PropertySHA-384SHA-512
Hash length384 bits512 bits
Word size64 bits64 bits
Block size1024 bits1024 bits
Words in the message schedule8080
Compression rounds8080
Initial hash valuesownown

The most obvious difference is the length of the finished hash value:

SHA-384 → 384 bits
SHA-512 → 512 bits

But as we've seen, SHA-384 doesn't arise from simply calculating an ordinary SHA-512 hash and truncating it afterward.

How Secure Is SHA-384?​

The length of the hash value influences the generic security strength of a cryptographic hash function.

For an idealized hash function with n bits of output, the effort for finding a collision, due to the birthday effect, is roughly on the order of:

2^(n/2)

With 384 bits, that gives:

2^192

For a generic preimage attack, by contrast, the order of magnitude is:

2^384

NIST accordingly lists the following security strengths for SHA-384:

PropertySecurity strength
Collision resistance192 bits
Preimage resistance384 bits
Second-preimage resistance384 bits

In collision resistance, SHA-384 thus lies between SHA-256 with 128 bits and SHA-512 with 256 bits of security strength.

A Peculiarity of Second-Preimage Resistance​

For some SHA-2 variants, the second-preimage security strength listed by NIST also depends on the length of the processed message.

With SHA-384, this is different.

NIST lists a second-preimage-resistance strength of 384 bits for SHA-384.

This is interesting because SHA-384 works internally on the 512-bit structure, but outputs only 384 bits of the final state.

For a basic understanding, the following takeaway is enough at this point:

SHA-384

Collision resistance → 192 bits
Preimage resistance → 384 bits
Second-preimage resistance → 384 bits

I explain in more detail what exactly distinguishes these three security properties from one another in the articles on collision resistance, preimage resistance, and second-preimage resistance.

Why Does SHA-384 Exist?​

An obvious question is:

Why do I need SHA-384 when SHA-256 and SHA-512 already exist?

SHA-384 offers a security and output length between these two variants.

The hash value requires:

48 bytes

instead of:

SHA-256 → 32 bytes
SHA-512 → 64 bytes

At the same time, SHA-384 is based on the 64-bit structure of SHA-512.

Which hash function should be used, however, doesn't depend on the desired number of bits alone. Standards and protocols often specify which hash function, or which security strength, is required.

NIST continues to list SHA-384 as an approved SHA-2 hash function. The SHA-2 family can be used for applications that require secure hash algorithms.

Should I Use SHA-384 or SHA-512?​

There is no universally valid answer that depends only on the number 384 or 512.

If a standard, protocol, or cryptographic scheme specifies SHA-384, exactly that variant should be used.

When making your own choice, the following play a role, among other things:

  • the security strength required,
  • interoperability,
  • the requirements of the protocol being used,
  • the size of the hash value,
  • and the cryptographic construction being used.

For applications of hash functions where interoperability is required, NIST recommends implementing at least SHA-256.

SHA-384 and SHA-512 are therefore not automatically "better" just because their hash values are longer. What matters is which requirements the respective application has.

SHA-384 Is Not SHA3-384​

In addition to SHA-384, there is also:

SHA3-384

Both produce a hash value with a length of 384 bits.

They belong to different hash families, however:

SHA-384 → SHA-2
SHA3-384 → SHA-3

SHA-384 is based on the SHA-512-like 64-bit structure of SHA-2.

SHA3-384, by contrast, is based on the Keccak construction that underlies the SHA-3 standard.

The identical output length therefore doesn't mean the algorithms are internally related or produce the same hash value for the same input.

We'll cover SHA-3 later as a topic of its own.

The Key Takeaways​

SHA-384 is a cryptographic hash function from the SHA-2 family and produces a 384-bit hash value.

It is closely related to SHA-512:

  • both work with 64-bit words,
  • both process 1024-bit blocks,
  • both use a message schedule with 80 words,
  • both perform 80 compression rounds per block.

SHA-384 is nevertheless not simply a truncated SHA-512 hash.

SHA-384 and SHA-512 use different initial hash values. That is why their internal states differ already during the calculation.

NIST lists a collision-resistance strength of 192 bits, a preimage-resistance strength of 384 bits, and a second-preimage-resistance strength of 384 bits for SHA-384.

With that, after SHA-224, we've now gotten to know both shortened variants of the two fundamental SHA-2 structures.

Next, What Are SHA-512/224 and SHA-512/256? is worth a look: the article shows why two further variants, SHA-512/224 and SHA-512/256, exist — and why SHA-512/256 in particular, despite its 256-bit output, is not the same as SHA-256.

Sources and Standards​

  1. National Institute of Standards and Technology (NIST), FIPS 180-4 – Secure Hash Standard (SHS) Normative specification of SHA-384, SHA-512, and the other algorithms of the SHA-2 family. Includes padding, initial hash values, functions, constants, message schedule, and compression function.

  2. National Institute of Standards and Technology (NIST), Hash Functions Overview of the hash functions approved by NIST and of their collision, preimage, and second-preimage security strengths.

  3. National Institute of Standards and Technology (NIST), Policy on Hash Functions Recommendation to implement at least SHA-256 when applications or protocols require interoperability of hash functions.