Skip to main content

What Is SHA-3?

SHA-3 is a family of cryptographic functions based on Keccak. It was standardized in 2015 by the U.S. National Institute of Standards and Technology (NIST) as FIPS 202.

The SHA-3 family includes four cryptographic hash functions with fixed hash lengths:

  • SHA3-224
  • SHA3-256
  • SHA3-384
  • SHA3-512

In addition, FIPS 202 defines two so-called Extendable-Output Functions (XOFs), SHAKE128 and SHAKE256, whose output length can be chosen flexibly.

At first glance, this closely resembles SHA-2, which also offers variants with 224-, 256-, 384-, and 512-bit hash values.

Technically, however, SHA-2 and SHA-3 have fundamentally different designs.

While the SHA-2 functions process messages block by block with compression functions, SHA-3 is based on a so-called Sponge Construction. Data is first absorbed into an internal state, and the output is then produced from that state.

This fundamentally different design is one of the reasons why SHA-3 is an interesting addition to SHA-2.

Importantly:

SHA-3 was not introduced because SHA-2 was broken or fundamentally insecure.

SHA-2 and SHA-3 are two different families of cryptographic hash functions, and both can still be used.

Why Was SHA-3 Developed?​

To understand how SHA-3 came about, we need to go back a little.

In the 2000s, there was significant progress in the cryptanalysis of various hash functions. In particular, attacks on SHA-1 raised serious concerns about its collision resistance.

NIST therefore began developing a new cryptographic hash standard.

Instead of specifying a new algorithm itself, NIST chose a public competition.

On November 2, 2007, the SHA-3 Cryptographic Hash Algorithm Competition was launched.

The goal was to develop a new cryptographic hash algorithm that would complement the hash functions already standardized.

In 2008, a total of 64 submissions were received by NIST.

Of these, 51 candidates were selected for the first round. 14 algorithms reached the second round, and finally five finalists remained:

  • BLAKE
  • Grøstl
  • JH
  • Keccak
  • Skein

These five algorithms were then analyzed further and discussed publicly.

On October 2, 2012, NIST finally announced the winner:

Keccak.

Keccak was designed by Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles Van Assche.

The selection of Keccak then led to the new SHA-3 standard.

In August 2015, NIST finally published FIPS 202 – SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions.

With that, the SHA-3 family was officially standardized.

SHA-3 Does Not Replace SHA-2​

The name "SHA-3" can easily give the impression that SHA-3 is simply the newer and therefore better version of SHA-2.

It is not quite that simple, however.

FIPS 202 explicitly describes the SHA-3 family as a complement to the hash functions already specified in FIPS 180-4.

That is an important difference.

For SHA-1, there are concrete cryptographic reasons why the algorithm should no longer be used in applications that require collision resistance.

For SHA-2, this is not the case.

Algorithms such as SHA-256 and SHA-512 can still be used in applications that require secure cryptographic hash functions. NIST also currently sees no general reason to switch existing SHA-2 applications to SHA-3.

Instead, SHA-3 provides an additional family whose internal design differs fundamentally from SHA-2.

SHA-3 should therefore not be understood as a "successor" that replaces SHA-2.

SHA-3 Is Based on Keccak​

All six SHA-3 functions defined in FIPS 202 are based on Keccak.

Keccak differs conceptually from SHA-2 in a major way.

At its core is a so-called Sponge Construction.

The name is actually quite easy to picture.

A sponge can first take up liquid and then release it again.

A sponge construction works in the abstract in a similar way:

Input
│
▼
Absorb
│
▼
┌────────────────────┐
│ internal state │
│ │
│ Keccak permutation │
└────────────────────┘
│
▼
Squeeze
│
▼
Output

In the absorbing phase, the input data is gradually absorbed into an internal state.

This state is repeatedly transformed by a permutation.

For the SHA-3 functions, FIPS 202 uses a Keccak permutation with a 1600-bit state and 24 rounds.

Once the entire input has been processed, the squeezing phase begins.

Data is now taken from the internal state as output.

Put simply, we can remember:

Absorb → transform → Squeeze

This principle is fundamental to SHA-3.

How exactly this works, and what role terms such as state, rate, and capacity play, we will look at in detail in How Does SHA-3 Work?.

Which Hash Functions Belong to SHA-3?​

FIPS 202 defines four cryptographic SHA-3 hash functions with fixed output lengths:

AlgorithmHash length
SHA3-224224 bits
SHA3-256256 bits
SHA3-384384 bits
SHA3-512512 bits

The number in the name indicates the length of the hash value produced.

SHA3-256, for example, always produces a hash value with a length of 256 bits.

That corresponds to 32 bytes or 64 hexadecimal characters.

SHA3-512, by contrast, produces a 512-bit hash value, i.e. 64 bytes or 128 hexadecimal characters.

The names therefore strongly resemble those of the SHA-2 family.

However, this does not mean that the corresponding algorithms are identical.

SHA-256 and SHA3-256 Are Not the Same​

Both SHA-256 and SHA3-256 produce a 256-bit hash value.

Nevertheless, they are two completely different hash functions.

Take the input:

hello

SHA-256 produces from this:

2cf24dba5fb0a30e26e83b2ac5b9e29e
1b161e5c1fa7425e73043362938b9824

SHA3-256, on the other hand, produces:

3338be694f50c5f338814986cdf06864
53a888b84f424d792af4b9202398f392

Both hash values are 256 bits long.

Yet they are completely different.

This is because SHA-256 and SHA3-256 use entirely different internal constructions.

The length of a hash value therefore does not reveal which algorithm produced it.

SHA-256 vs. SHA3-256

Compare SHA-256 and SHA3-256 for the same input. Both produce 256-bit hash values, but they are entirely different hash functions.

UTF-8 bytes: 0

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

SHA3-256 is not simply a new version of SHA-256.

SHA-3 Also Includes SHAKE128 and SHAKE256​

In addition to the four SHA-3 hash functions, FIPS 202 defines two further functions:

  • SHAKE128
  • SHAKE256

These are so-called Extendable-Output Functions, or XOFs for short.

The decisive difference from a classic hash function lies in the output length.

SHA3-256 always produces exactly 256 bits.

With SHAKE, by contrast, the desired output length is specified.

A SHAKE function can, for example, produce outputs with the following lengths:

256 bits
512 bits
1024 bits
2048 bits
...

The output is therefore not limited to a single fixed length.

This works particularly well with the sponge construction, because further output bits can be generated during the squeezing phase until the desired length is reached.

One peculiarity of the names should be noted:

In SHA3-256, the number 256 denotes the length of the hash value.

In SHAKE128 and SHAKE256, by contrast, 128 and 256 denote the security strength these functions are designed to support — not their output length.

We will therefore look at SHAKE128 and SHAKE256 separately later.

How Does SHA-3 Work in Principle?​

The precise structure of SHA-3 is considerably more complex than I could sensibly explain in a single overview article.

The basic principle can nevertheless be reduced to a few steps.

1. The Input Is Prepared​

First, the message must be prepared for processing.

For the four SHA-3 hash functions, a two-bit suffix 01 is first appended to the message. This suffix supports so-called domain separation.

Then the Keccak padding pad10*1 is applied.

2. The Data Is Absorbed​

The prepared message is absorbed block by block into the internal state.

This phase is called the absorbing phase.

3. The Internal State Is Transformed​

During processing, the internal state is transformed by the Keccak permutation.

The SHA-3 functions in FIPS 202 use KECCAK-p[1600,24] for this: a 1600-bit state and 24 permutation rounds.

4. The Output Is Produced​

After the entire input has been processed, the squeezing phase begins.

Bits are taken from the internal state as output.

For SHA3-256, this continues until 256 output bits have been produced.

For SHA3-512, 512 bits are produced accordingly.

For SHAKE, by contrast, this process can continue until the desired output length has been reached.

Rate and Capacity​

The internal state of a sponge construction is conceptually divided into two parts:

rate and capacity.

In this case:

State = Rate + Capacity

For the SHA-3 functions, the size of the state is 1600 bits.

The rate determines, among other things, how many bits interact with the input or output in each step.

The capacity is the remaining part of the internal state and is closely tied to the security properties of the sponge construction.

For the four SHA-3 hash functions, FIPS 202 sets the capacity to twice the respective digest length.

For SHA3-256, for example:

Rate = 1088 bits
Capacity = 512 bits
-------------------
State = 1600 bits

For SHA3-512, the division looks like this:

Rate = 576 bits
Capacity = 1024 bits
-------------------
State = 1600 bits

Depending on the SHA-3 variant, the rate and capacity change, while the size of the internal state stays the same.

Why this is so, and what effects these parameters have on processing and security, we will examine more closely in the article on the sponge construction.

SHA-2 and SHA-3 Work Fundamentally Differently​

SHA-2 and SHA-3 follow different design principles.

In simplified form, some differences can be contrasted as follows:

PropertySHA-2SHA-3
StandardFIPS 180FIPS 202
Basic constructionblock-by-block processing with compression functionsSponge Construction
Internal coreSHA-2 compression functionsKeccak permutation
256-bit variantSHA-256SHA3-256
512-bit variantSHA-512SHA3-512
Extendable outputnot part of SHA-2SHAKE128 / SHAKE256

This also means:

SHA-256 ≠ SHA3-256

and:

SHA-512 ≠ SHA3-512

The same number in the name merely describes the length of the respective hash value.

It does not mean that the algorithms work the same way internally.

Is SHA-3 More Secure Than SHA-2?​

"Is SHA-3 more secure than SHA-2?" sounds at first like a simple question.

A blanket answer such as:

SHA-3 is newer and therefore more secure.

would, however, be misleading.

SHA-2 and SHA-3 provide different cryptographic constructions.

The four SHA-3 hash functions, like the SHA-2 functions, are intended for applications that require secure cryptographic hash algorithms.

A key advantage of SHA-3 is that the family provides a structurally different alternative to SHA-2.

SHA-3 is not simply based on a slightly modified SHA-2 construction.

The two families differ fundamentally.

For that reason, SHA-3 is better understood as an alternative cryptographic construction than as "SHA-2, just more secure."

NIST also currently sees no general reason to switch existing applications from SHA-2 to SHA-3 for that reason alone.

SHA-3 and Keccak Are Not Simply Interchangeable Terms​

There is an important nuance here that is particularly relevant for developers.

SHA-3 is based on Keccak. Nevertheless, a function that a library or protocol calls Keccak-256 is not automatically identical to the standardized function SHA3-256.

FIPS 202 defines SHA3-256 specifically as a particular Keccak-based construction.

For the SHA-3 hash functions, among other things, the two-bit suffix 01 is appended to the message. This suffix serves domain separation.

SHAKE128 and SHAKE256, for example, use a different suffix (1111).

Such details of the concrete function definition are decisive: two functions can use the same underlying Keccak construction and still produce different results for the same input.

For this reason, the following holds for the method commonly called Keccak-256, for example:

SHA3-256("hello") ≠ Keccak-256("hello")

This matters in practice, because libraries and protocols sometimes explicitly refer to Keccak-256.

A well-known example can be found in the Ethereum ecosystem.

Anyone implementing cryptographic functions or choosing a library should therefore check carefully which specific function a standard or protocol requires.

"Keccak" and "SHA-3" should not be treated as interchangeable names across the board.

When Should I Use SHA-3?​

SHA-3 can be useful or even required, for example, when a standard or protocol explicitly calls for a SHA-3 function.

Even where a standardized cryptographic hash construction is deliberately wanted that differs structurally from SHA-2, SHA-3 offers an alternative.

SHAKE128 and SHAKE256 additionally open up applications that need a flexibly selectable output length.

However, the existence of SHA-3 does not mean that existing applications must automatically be switched from SHA-256 to SHA3-256.

If a system uses SHA-256 correctly for a suitable use case, a migration is not necessary merely because of the higher number in the name of SHA-3.

Which function is suitable depends on the specific use case and on the respective requirements or standards.

SHA-3 Is Not a Password Hash Function​

A cryptographically secure hash function is not automatically suitable for storing passwords.

This applies to SHA-2 just as much as to SHA-3.

Applying SHA3-256 directly to a password and merely storing the resulting hash value is not a modern approach to secure password storage.

Dedicated password-hashing schemes exist for this purpose, such as:

  • Argon2
  • scrypt
  • bcrypt

These schemes pursue different goals than general cryptographic hash functions and are deliberately designed so that mass testing of password candidates becomes more expensive for attackers.

We will look at password hashing separately.

The Most Important Points in Brief​

SHA-3 is a family of cryptographic functions based on Keccak, standardized by NIST in FIPS 202.

The most important points to remember:

  • SHA-3 is based on Keccak, the winner of the SHA-3 competition.
  • NIST selected Keccak as the winner in 2012.
  • FIPS 202 was published in 2015.
  • SHA-3 uses a sponge construction and therefore differs fundamentally from SHA-2.
  • SHA3-224 produces a 224-bit hash value.
  • SHA3-256 produces a 256-bit hash value.
  • SHA3-384 produces a 384-bit hash value.
  • SHA3-512 produces a 512-bit hash value.
  • SHAKE128 and SHAKE256 are extendable-output functions with a flexibly selectable output length.
  • The numbers 128 and 256 in SHAKE128 and SHAKE256 do not denote a fixed output length.
  • SHA-3 does not simply replace SHA-2.
  • SHA3-256 and SHA-256 are different hash functions.
  • SHA3-256 and the method commonly called Keccak-256 are likewise not identical.
  • Like SHA-2, SHA-3 is not a dedicated password hash function.

With that, we now know the most important components of the SHA-3 family.

The next step is to look at how SHA-3 works internally — in particular what happens when data is absorbed and output, and what role the state, rate, capacity, and the Keccak permutation play.

Sources and Further Standards​

  1. NIST FIPS 202 – SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions The central NIST standard for SHA3-224, SHA3-256, SHA3-384, SHA3-512, SHAKE128, and SHAKE256.

  2. NIST IR 7896 – Third-Round Report of the SHA-3 Cryptographic Hash Algorithm Competition The final report on the SHA-3 competition, covering the selection process, the five finalists, and the decision in favor of Keccak.

  3. NIST – SHA-3 Project NIST overview of the SHA-3 competition and the selection of Keccak.

  4. NIST – Policy on Hash Functions Current NIST guidance on the use of SHA-2 and SHA-3, including the statement that no general transition from SHA-2 to SHA-3 is currently required.