Recent from talks
Nothing was collected or created yet.
SHA-3
View on Wikipedia
| Secure Hash Algorithms | |
|---|---|
| Concepts | |
| hash functions, SHA, DSA | |
| Main standards | |
| SHA-0, SHA-1, SHA-2, SHA-3 | |
| General | |
|---|---|
| Designers | Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles van Assche. |
| First published | 2016 |
| Series | (SHA-0), SHA-1, SHA-2, SHA-3 |
| Certification | FIPS PUB 202 |
| Detail | |
| Digest sizes | arbitrary |
| Structure | sponge construction |
| Speed | 12.6 cpb on a typical x86-64-based machine for Keccak-f[1600] plus XORing 1024 bits,[1] which roughly corresponds to SHA2-256. |
| Best public cryptanalysis | |
| Preimage attack on Keccak-512 reduced to 8 rounds, requiring 2511.5 time and 2508 memory.[2] Zero-sum distinguishers exist for the full 24-round Keccak-f[1600], though they cannot be used to attack the hash function itself[3] | |
SHA-3 (Secure Hash Algorithm 3) is the latest[4] member of the Secure Hash Algorithm family of standards, released by NIST on August 5, 2015.[5][6][7] Although part of the same series of standards, SHA-3 is internally different from the MD5-like structure of SHA-1 and SHA-2.
SHA-3 is a subset of the broader cryptographic primitive family Keccak (/ˈkɛtʃæk/ or /ˈkɛtʃɑːk/),[8][9] designed by Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles Van Assche, building upon RadioGatún. Keccak's authors have proposed additional uses for the function, not (yet) standardized by NIST, including a stream cipher, an authenticated encryption system, a "tree" hashing scheme for faster hashing on certain architectures,[10][11] and AEAD ciphers Keyak and Ketje.[12][13]
Keccak is based on a novel approach called sponge construction.[14] Sponge construction is based on a wide random function or random permutation, and allows inputting ("absorbing" in sponge terminology) any amount of data, and outputting ("squeezing") any amount of data, while acting as a pseudorandom function with regard to all previous inputs. This leads to great flexibility.
As of 2022,[update] NIST does not plan to withdraw SHA-2 or remove it from the revised Secure Hash Standard.[15] The purpose of SHA-3 is that it can be directly substituted for SHA-2 in current applications if necessary, and to significantly improve the robustness of NIST's overall hash algorithm toolkit.[16]
For small message sizes, the creators of the Keccak algorithms and the SHA-3 functions suggest using the faster function KangarooTwelve with adjusted parameters and a new tree hashing mode without extra overhead.
History
[edit]The Keccak algorithm is the work of Guido Bertoni, Joan Daemen (who also co-designed the Rijndael cipher with Vincent Rijmen), Michaël Peeters, and Gilles Van Assche. It is based on earlier hash function designs PANAMA and RadioGatún. PANAMA was designed by Daemen and Craig Clapp in 1998. RadioGatún, a successor of PANAMA, was designed by Daemen, Peeters, and Van Assche, and was presented at the NIST Hash Workshop in 2006.[17] The reference implementation source code was dedicated to public domain via CC0 waiver.[18]
In 2006, NIST started to organize the NIST hash function competition to create a new hash standard, SHA-3. SHA-3 is not meant to replace SHA-2, as no significant attack on SHA-2 has been publicly demonstrated [needs update]. Because of the successful attacks on MD5, SHA-0 and SHA-1,[19][20] NIST perceived a need for an alternative, dissimilar cryptographic hash, which became SHA-3.
After a setup period, admissions were to be submitted by the end of 2008. Keccak was accepted as one of the 51 candidates. In July 2009, 14 algorithms were selected for the second round. Keccak advanced to the last round in December 2010.[21]
During the competition, entrants were permitted to "tweak" their algorithms to address issues that were discovered. Changes that have been made to Keccak are:[22][23]
- The number of rounds was increased from 12 + ℓ to 12 + 2ℓ to be more conservative about security.
- The message padding was changed from a more complex scheme to the simple 10*1 pattern described below.
- The rate r was increased to the security limit, rather than rounding down to the nearest power of 2.
On October 2, 2012, Keccak was selected as the winner of the competition.[8]
In 2014, the NIST published a draft FIPS 202 "SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions".[24] FIPS 202 was approved on August 5, 2015.[25]
On August 5, 2015, NIST announced that SHA-3 had become a hashing standard.[26]
Weakening controversy
[edit]In early 2013 NIST announced they would select different values for the "capacity", the overall strength vs. speed parameter, for the SHA-3 standard, compared to the submission.[27][28] The changes caused some turmoil.
The hash function competition called for hash functions at least as secure as the SHA-2 instances. It means that a d-bit output should have d/2-bit resistance to collision attacks and d-bit resistance to preimage attacks, the maximum achievable for d bits of output. Keccak's security proof allows an adjustable level of security based on a "capacity" c, providing c/2-bit resistance to both collision and preimage attacks. To meet the original competition rules, Keccak's authors proposed c = 2d. The announced change was to accept the same d/2-bit security for all forms of attack and standardize c = d. This would have sped up Keccak by allowing an additional d bits of input to be hashed each iteration. However, the hash functions would not have been drop-in replacements with the same preimage resistance as SHA-2 any more; it would have been cut in half, making it vulnerable to advances in quantum computing, which effectively would cut it in half once more.[29]
In September 2013, Daniel J. Bernstein suggested on the NIST hash-forum mailing list[30] to strengthen the security to the 576-bit capacity that was originally proposed as the default Keccak, in addition to and not included in the SHA-3 specifications.[31] This would have provided at least a SHA3-224 and SHA3-256 with the same preimage resistance as their SHA-2 predecessors, but SHA3-384 and SHA3-512 would have had significantly less preimage resistance than their SHA-2 predecessors. In late September, the Keccak team responded by stating that they had proposed 128-bit security by setting c = 256 as an option already in their SHA-3 proposal.[32] Although the reduced capacity was justifiable in their opinion, in the light of the negative response, they proposed raising the capacity to c = 512 bits for all instances. This would be as much as any previous standard up to the 256-bit security level, while providing reasonable efficiency,[33] but not the 384-/512-bit preimage resistance offered by SHA2-384 and SHA2-512. The authors stated that "claiming or relying on security strength levels above 256 bits is meaningless".
In early October 2013, Bruce Schneier criticized NIST's decision on the basis of its possible detrimental effects on the acceptance of the algorithm, saying:
There is too much mistrust in the air. NIST risks publishing an algorithm that no one will trust and no one (except those forced) will use.[34]
He later retracted his earlier statement, saying:
I misspoke when I wrote that NIST made "internal changes" to the algorithm. That was sloppy of me. The Keccak permutation remains unchanged. What NIST proposed was reducing the hash function's capacity in the name of performance. One of Keccak's nice features is that it's highly tunable.[34]
Paul Crowley, a cryptographer and senior developer at an independent software development company, expressed his support of the decision, saying that Keccak is supposed to be tunable and there is no reason for different security levels within one primitive. He also added:
Yes, it's a bit of a shame for the competition that they demanded a certain security level for entrants, then went to publish a standard with a different one. But there's nothing that can be done to fix that now, except re-opening the competition. Demanding that they stick to their mistake doesn't improve things for anyone.[35]
There was some confusion that internal changes may have been made to Keccak, which were cleared up by the original team, stating that NIST's proposal for SHA-3 is a subset of the Keccak family, for which one can generate test vectors using their reference code submitted to the contest, and that this proposal was the result of a series of discussions between them and the NIST hash team.[36]
In response to the controversy, in November 2013 John Kelsey of NIST proposed to go back to the original c = 2d proposal for all SHA-2 drop-in replacement instances.[37] The reversion was confirmed in subsequent drafts[38] and in the final release.[5]
Design
[edit]
SHA-3 uses the sponge construction,[14] in which data is "absorbed" into the sponge, then the result is "squeezed" out. In the absorbing phase, message blocks are XORed into a subset of the state, which is then transformed as a whole using a permutation function (or transformation) . In the "squeeze" phase, output blocks are read from the same subset of the state, alternated with the state transformation function . The size of the part of the state that is written and read is called the "rate" (denoted ), and the size of the part that is untouched by input/output is called the "capacity" (denoted ). The capacity determines the security of the scheme. The maximum security level is half the capacity.
Given an input bit string , a padding function , a permutation function that operates on bit blocks of width , a rate and an output length , we have capacity and the sponge construction . This yields a bit string of length as follows:[6]: 18
- pad the input N using the pad function, yielding a padded bit string P with a length divisible by (such that is an integer)
- break P into n consecutive r-bit pieces P0, ..., Pn−1
- initialize the state S to a string of b zero bits
- absorb the input into the state: for each block Pi:
- extend Pi at the end by a string of c zero bits, yielding one of length b
- XOR that with S
- apply the block permutation f to the result, yielding a new state S
- initialize Z to be the empty string
- while the length of Z is less than d:
- append the first r bits of S to Z
- if Z is still less than d bits long, apply f to S, yielding a new state S
- truncate Z to d bits
The fact that the internal state S contains c additional bits of information in addition to what is output to Z prevents the length extension attacks that SHA-2, SHA-1, MD5 and other hashes based on the Merkle–Damgård construction are susceptible to.
In SHA-3, the state S consists of a 5 × 5 array of w-bit words (with w = 64), b = 5 × 5 × w = 5 × 5 × 64 = 1600 bits total. Keccak is also defined for smaller power-of-2 word sizes w down to 1 bit (total state of 25 bits). Small state sizes can be used to test cryptanalytic attacks, and intermediate state sizes (from w = 8, 200 bits, to w = 32, 800 bits) can be used in practical, lightweight applications.[12][13]
For SHA3-224, SHA3-256, SHA3-384, and SHA3-512 instances, r is greater than d, so there is no need for additional block permutations in the squeezing phase; the leading d bits of the state are the desired hash. However, SHAKE128 and SHAKE256 allow an arbitrary output length, which is useful in applications such as optimal asymmetric encryption padding.
Padding
[edit]To ensure the message can be evenly divided into r-bit blocks, padding is required. SHA-3 uses the pattern 10...01 in its padding function: a 1 bit, followed by zero or more 0 bits (maximum r − 1) and a final 1 bit.
The maximum of r − 1 zero bits occurs when the last message block is r − 1 bits long. Then another block is added after the initial 1 bit, containing r − 1 zero bits before the final 1 bit.
The two 1 bits will be added even if the length of the message is already divisible by r.[6]: 5.1 In this case, another block is added to the message, containing a 1 bit, followed by a block of r − 2 zero bits and another 1 bit. This is necessary so that a message with length divisible by r ending in something that looks like padding does not produce the same hash as the message with those bits removed.
The initial 1 bit is required so messages differing only in a few additional 0 bits at the end do not produce the same hash.
The position of the final 1 bit indicates which rate r was used (multi-rate padding), which is required for the security proof to work for different hash variants. Without it, different hash variants of the same short message would be the same up to truncation.
The block permutation
[edit]The block transformation f, which is Keccak-f[1600] for SHA-3, is a permutation that uses XOR, AND and NOT operations, and is designed for easy implementation in both software and hardware.
It is defined for any power-of-two word size, w = 2ℓ bits. The main SHA-3 submission uses 64-bit words, ℓ = 6.
The state can be considered to be a 5 × 5 × w array of bits. Let a[i][ j][k] be bit (5i + j) × w + k of the input, using a little-endian bit numbering convention and row-major indexing. I.e. i selects the row, j the column, and k the bit.
Index arithmetic is performed modulo 5 for the first two dimensions and modulo w for the third.
The basic block permutation function consists of 12 + 2ℓ rounds of five steps:
- θ (theta)
- Compute the parity of each of the 5w (320, when w = 64) 5-bit columns, and exclusive-or that into two nearby columns in a regular pattern. To be precise, a[i][ j][k] ← a[i][ j][k] ⊕ parity(a[0...4][j-1][k]) ⊕ parity(a[0...4][j+1][k−1])
- ρ (rho)
- Bitwise rotate each of the 25 words by a different triangular number 0, 1, 3, 6, 10, 15, .... To be precise, a[0][0] is not rotated, and for all 0 ≤ t < 24, a[i][ j][k] ← a[i][ j][k−(t+1)(t+2)/2], where .
- π (pi)
- Permute the 25 words in a fixed pattern. a[3i+2j][i] ← a[ i][j].
- χ (chi)
- Bitwise combine along rows, using x ← x ⊕ (¬y & z). To be precise, a[i][ j][k] ← a[i][ j][k] ⊕ (¬a[i][ j+1][k] & a[i][ j+2][k]). This is the only non-linear operation in SHA-3.
- ι (iota)
- Exclusive-or a round constant into one word of the state. To be precise, in round n, for 0 ≤ m ≤ ℓ, a[0][0][2m−1] is XORed with bit m + 7n of a degree-8 LFSR sequence. This breaks the symmetry that is preserved by the other steps.
Speed
[edit]The speed of SHA-3 hashing of long messages is dominated by the computation of f = Keccak-f[1600] and XORing S with the extended Pi, an operation on b = 1600 bits. However, since the last c bits of the extended Pi are 0 anyway, and XOR with 0 is a NOP, it is sufficient to perform XOR operations only for r bits (r = 1600 − 2 × 224 = 1152 bits for SHA3-224, 1088 bits for SHA3-256, 832 bits for SHA3-384 and 576 bits for SHA3-512). The lower r is (and, conversely, the higher c = b − r = 1600 − r), the less efficient but more secure the hashing becomes since fewer bits of the message can be XORed into the state (a quick operation) before each application of the computationally expensive f. The authors report the following speeds for software implementations of Keccak-f[1600] plus XORing 1024 bits,[1] which roughly corresponds to SHA3-256:
- 57.4 cpb on IA-32, Intel Pentium 3[39]
- 41 cpb on IA-32+MMX, Intel Pentium 3
- 20 cpb on IA-32+SSE, Intel Core 2 Duo or AMD Athlon 64
- 12.6 cpb on a typical x86-64-based machine
- 6–7 cpb on IA-64[1]
For the exact SHA3-256 on x86-64, Bernstein measures 11.7–12.25 cpb depending on the CPU.[40]: 7 SHA-3 has been criticized for being slow on instruction set architectures (CPUs) which do not have instructions meant specially for computing Keccak functions faster – SHA2-512 is more than twice as fast as SHA3-512, and SHA-1 is more than three times as fast on an Intel Skylake processor clocked at 3.2 GHz.[41] The authors have reacted to this criticism by suggesting to use SHAKE128 and SHAKE256 instead of SHA3-256 and SHA3-512, at the expense of cutting the preimage resistance in half (but while keeping the collision resistance). With this, performance is on par with SHA2-256 and SHA2-512.
However, in hardware implementations, SHA-3 is notably faster than all other finalists,[42] and also faster than SHA-2 and SHA-1.[41]
As of 2018, ARM's ARMv8[43] architecture includes special instructions which enable Keccak algorithms to execute faster and IBM's z/Architecture[44] includes a complete implementation of SHA-3 and SHAKE in a single instruction. There have also been extension proposals for RISC-V to add Keccak-specific instructions.[45]
Instances
[edit]The NIST standard defines the following instances, for message M and output length d:[6]: 20, 23
| Instance | Output size d |
Rate r = block size |
Capacity c | Definition | Security strength in bits of resistance against | ||
|---|---|---|---|---|---|---|---|
| Collision | Preimage | 2nd preimage | |||||
| SHA3-224(M) | 224 | 1152 | 448 | Keccak[448](M || 01, 224) | 112 | 224 | 224 |
| SHA3-256(M) | 256 | 1088 | 512 | Keccak[512](M || 01, 256) | 128 | 256 | 256 |
| SHA3-384(M) | 384 | 832 | 768 | Keccak[768](M || 01, 384) | 192 | 384 | 384 |
| SHA3-512(M) | 512 | 576 | 1024 | Keccak[1024](M || 01, 512) | 256 | 512 | 512 |
| SHAKE128(M, d) | d | 1344 | 256 | Keccak[256](M || 1111, d) | min(d/2,128) | ≥min(d,128) | min(d,128) |
| SHAKE256(M, d) | d | 1088 | 512 | Keccak[512](M || 1111, d) | min(d/2,256) | ≥min(d,256) | min(d,256) |
With the following definitions
- Keccak[c](N, d) = sponge[Keccak-f[1600], pad10*1, r](N, d)[6]: 20
- Keccak-f[1600] = Keccak-p[1600, 24][6]: 17
- c is the capacity
- r is the rate = 1600 − c
- N is the input bit string
SHA-3 instances are drop-in replacements for SHA-2, intended to have identical security properties.
SHAKE will generate as many bits from its sponge as requested, thus being extendable-output functions (XOFs). For example, SHAKE128(M, 256) can be used as a hash function with a 256 character bitstream with 128-bit security strength. Arbitrarily large lengths can be used as pseudo-random number generators. Alternately, SHAKE256(M, 128) can be used as a hash function with a 128-bit length and 128-bit resistance.[6]
All instances append some bits to the message, the rightmost of which represent the domain separation suffix. The purpose of this is to ensure that it is not possible to construct messages that produce the same hash output for different applications of the Keccak hash function. The following domain separation suffixes exist:[6][46]
| Suffix | Meaning |
|---|---|
| ...0 | reserved for future use |
| 01 | SHA-3 |
| ...11 | RawSHAKE |
| 1111 | SHAKE |
Additional instances
[edit]In December 2016 NIST published a new document, NIST SP.800-185,[47] describing additional SHA-3-derived functions:
| Instance | Description |
|---|---|
| cSHAKE128(X, L, N, S) | A version of SHAKE supporting explicit domain separation via customization parameters. |
| cSHAKE256(X, L, N, S) | |
| KMAC128(K, X, L, S) | A keyed hash function based on Keccak. Can also be used without a key as a regular hash function. |
| KMAC256(K, X, L, S) | |
| KMACXOF128(K, X, L, S) | |
| KMACXOF256(K, X, L, S) | |
| TupleHash128(X, L, S) | A function for hashing tuples of strings. The output of this function depends on both the contents and the sequence of input strings. |
| TupleHash256(X, L, S) | |
| TupleHashXOF128(X, L, S) | |
| TupleHashXOF256(X, L, S) | |
| ParallelHash128(X, B, L, S) | A function designed to exploit parallelism in modern processors for faster hashing. Unlike KangarooTwelve, does not use reduced-round Keccak. |
| ParallelHash256(X, B, L, S) | |
| ParallelHashXOF128(X, B, L, S) | |
| ParallelHashXOF256(X, B, L, S) |
• X is the main input bit string. It may be of any length, including zero.
• L is an integer representing the requested output length in bits.
• N is a function-name bit string, used by NIST to define functions based on cSHAKE. When no function other than cSHAKE is desired, N is set to the empty string.
• S is a customization bit string. The user selects this string to define a variant of the function. When no customization is desired, S is set to the empty string.
• K is a key bit string of any length, including zero.
• B is the block size in bytes for parallel hashing. It may be any integer such that 0 < B < 22040.
Later developments
[edit]KangarooTwelve
[edit]| General | |
|---|---|
| Designers | Guido Bertoni, Joan Daemen, Michaël Peeters, Gilles Van Assche, Ronny Van Keer, Benoît Viguier |
| First published | August 10, 2016 |
| Derived from | Keccak |
| Detail | |
| Digest sizes | arbitrary |
| Structure | sponge construction and tree hashing with kangaroo hopping |
| Rounds | 12 |
| Speed | 0.51 cpb on SkylakeX with AVX-512[48] |
| Best public cryptanalysis | |
| Same as Keccak's | |
In 2016 the same team that made the SHA-3 functions and the Keccak algorithm introduced faster reduced-rounds (reduced to 12 and 14 rounds, from the 24 in SHA-3) alternatives which can exploit the availability of parallel execution by using tree hashing: KangarooTwelve and MarsupilamiFourteen.[49]
These functions differ from ParallelHash, the FIPS standardized Keccak-based parallelizable hash function, with regard to the parallelism, in that they are faster than ParallelHash for small message sizes.
The reduced number of rounds is justified by the huge cryptanalytic effort focused on Keccak which did not produce practical attacks on anything close to twelve-round Keccak. These higher-speed algorithms are not part of SHA-3 (as they are a later development), and thus are not FIPS compliant; but because they use the same Keccak permutation they are secure for as long as there are no attacks on SHA-3 reduced to 12 rounds.[49]
KangarooTwelve is a higher-performance reduced-round (from 24 to 12 rounds) version of Keccak which claims to have 128 bits of security[50] while having performance as high as 0.55 cycles per byte on a Skylake CPU.[51] This algorithm is an IETF RFC draft.[52]
MarsupilamiFourteen, a slight variation on KangarooTwelve, uses 14 rounds of the Keccak permutation and claims 256 bits of security. Note that 256-bit security is not more useful in practice than 128-bit security, but may be required by some standards.[50] 128 bits are already sufficient to defeat brute-force attacks on current hardware, so having 256-bit security does not add practical value, unless the user is worried about significant advancements in the speed of classical computers. For resistance against quantum computers, see below.
KangarooTwelve and MarsupilamiFourteen are Extendable-Output Functions, similar to SHAKE, therefore they generate closely related output for a common message with different output length (the longer output is an extension of the shorter output). Such property is not exhibited by hash functions such as SHA-3 or ParallelHash (except of XOF variants).[6]
The Farfalle construction
[edit]In 2016, the Keccak team released a different construction called Farfalle construction, and Kravatte, an instance of Farfalle using the Keccak-p permutation,[53] as well as two authenticated encryption algorithms Kravatte-SANE and Kravatte-SANSE[54]
Sakura tree hashing
[edit]RawSHAKE is the basis for the Sakura coding for tree hashing, which has not been standardized yet. Sakura uses a suffix of 1111 for single nodes, equivalent to SHAKE, and other generated suffixes depending on the shape of the tree.[46]: 16
Security against quantum attacks
[edit]There is a general result (Grover's algorithm) that quantum computers can perform a structured preimage attack in , while a classical brute-force attack needs 2d. A structured preimage attack implies a second preimage attack[29] and thus a collision attack. A quantum computer can also perform a birthday attack, thus break collision resistance, in [55] (although that is disputed).[56] Noting that the maximum strength can be , this gives the following upper[57] bounds on the quantum security of SHA-3:
| Instance | Security strength in bits of resistance against | |||
|---|---|---|---|---|
| Collision (Brassard et al.) |
Collision (Bernstein) |
Preimage | 2nd preimage | |
| SHA3-224(M) | 74+2⁄3 | 112 | 112 | 112 |
| SHA3-256(M) | 85+1⁄3 | 128 | 128 | 128 |
| SHA3-384(M) | 128 | 192 | 192 | 192 |
| SHA3-512(M) | 170+2⁄3 | 256 | 256 | 256 |
| SHAKE128(M, d) | min(d/3,128) | min(d/2,128) | ≥min(d/2,128) | min(d/2,128) |
| SHAKE256(M, d) | min(d/3,256) | min(d/2,256) | ≥min(d/2,256) | min(d/2,256) |
It has been shown that the Merkle–Damgård construction, as used by SHA-2, is collapsing and, by consequence, quantum collision-resistant,[58] but for the sponge construction used by SHA-3, the authors provide proofs only for the case when the block function f is not efficiently invertible; Keccak-f[1600], however, is efficiently invertible, and so their proof does not apply.[59][original research]
Examples of SHA-3 variants
[edit]The following hash values are from NIST.gov:[60]
SHA3-224("") 6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7 SHA3-256("") a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a SHA3-384("") 0c63a75b845e4f7d01107d852e4c2485c51a50aaaa94fc61995e71bbee983a2ac3713831264adb47fb6bd1e058d5f004 SHA3-512("") a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26 SHAKE128("", 256) 7f9c2ba4e88f827d616045507605853ed73b8093f6efbc88eb1a6eacfa66ef26 SHAKE256("", 512) 46b9dd2b0ba88d13233b3feb743eeb243fcd52ea62b81b82b50c27646ed5762fd75dc4ddd8c0f200cb05019d67b592f6fc821c49479ab48640292eacb3b7c4be
Changing a single bit causes each bit in the output to change with 50% probability, demonstrating an avalanche effect:
SHAKE128("The quick brown fox jumps over the lazy dog", 256) f4202e3c5852f9182a0430fd8144f0a74b95e7417ecae17db0f8cfeed0e3e66e SHAKE128("The quick brown fox jumps over the lazy dof", 256) 853f4538be0db9621a6cea659a06c1107b1f83f02b13d18297bd39d7411cf10c
Comparison of SHA functions
[edit]In the table below, internal state means the number of bits that are carried over to the next block.
| Algorithm and variant | Output size (bits) |
Internal state size (bits) |
Block size (bits) |
Rounds | Operations | Security (bits) |
Performance on Skylake (median cpb)[61] | First published | ||
|---|---|---|---|---|---|---|---|---|---|---|
| Long messages | 8 bytes | |||||||||
| MD5 (as reference) | 128 | 128 (4 × 32) |
512 | 4 (16 operations in each round) |
And, Xor, Or, Rot, Add (mod 232) | ≤ 18 (collisions found)[62] |
4.99 | 55.00 | 1992 | |
| SHA-0 | 160 | 160 (5 × 32) |
512 | 80 | And, Xor, Or, Rot, Add (mod 232) | < 34 (collisions found) |
≈ SHA-1 | ≈ SHA-1 | 1993 | |
| SHA-1 | < 63 (collisions found)[63] |
3.47 | 52.00 | 1995 | ||||||
| SHA-2 | SHA-224 SHA-256 |
224 256 |
256 (8 × 32) |
512 | 64 | And, Xor, Or, Rot, Shr, Add (mod 232) |
112 128 |
7.62 7.63 |
84.50 85.25 |
2004 2001 |
| SHA-384 | 384 | 512 (8 × 64) |
1024 | 80 | And, Xor, Or, Rot, Shr, Add (mod 264) |
192 | 5.12 | 135.75 | 2001 | |
| SHA-512 | 512 | 256 | 5.06 | 135.50 | 2001 | |||||
| SHA-512/224 SHA-512/256 |
224 256 |
112 128 |
≈ SHA-384 | ≈ SHA-384 | 2012 | |||||
| SHA-3 | SHA3-224 SHA3-256 SHA3-384 SHA3-512 |
224 256 384 512 |
1600 (5 × 5 × 64) |
1152 1088 832 576 |
24[64] | And, Xor, Rot, Not | 112 128 192 256 |
8.12 8.59 11.06 15.88 |
154.25 155.50 164.00 164.00 |
2015 |
| SHAKE128 SHAKE256 |
d (arbitrary) d (arbitrary) |
1344 1088 |
min(d/2, 128) min(d/2, 256) |
7.08 8.59 |
155.25 155.50 | |||||
Optimized implementation using AVX-512VL (i.e. from OpenSSL, running on Skylake-X CPUs) of SHA3-256 do achieve about 6.4 cycles per byte for large messages,[65] and about 7.8 cycles per byte when using AVX2 on Skylake CPUs.[66] Performance on other x86, Power and ARM CPUs depending on instructions used, and exact CPU model varies from about 8 to 15 cycles per byte,[67][68][69] with some older x86 CPUs up to 25–40 cycles per byte.[70]
Implementations
[edit]Below is a list of cryptography libraries that support SHA-3:
Hardware acceleration
[edit]Apple A13 ARMv8 six-core SoC CPU cores have support[71] for accelerating SHA-3 (and SHA-512) using specialized instructions (EOR3, RAX1, XAR, BCAX) from ARMv8.2-SHA crypto extension set.[72]
Some software libraries use vectorization facilities of CPUs to accelerate usage of SHA-3. For example, Crypto++ can use SSE2 on x86 for accelerating SHA3,[73] and OpenSSL can use MMX, AVX-512 or AVX-512VL on many x86 systems too.[74] Also POWER8 CPUs implement 2x64-bit vector rotate, defined in PowerISA 2.07, which can accelerate SHA-3 implementations.[75] Most implementations for ARM do not use Neon vector instructions as scalar code is faster. ARM implementations can however be accelerated using SVE and SVE2 vector instructions; these are available in the Fujitsu A64FX CPU for instance.[76]
The IBM z/Architecture supports SHA-3 since 2017 as part of the Message-Security-Assist Extension 6.[77] The processors support a complete implementation of the entire SHA-3 and SHAKE algorithms via the KIMD and KLMD instructions using a hardware assist engine built into each core.
Usage in protocols
[edit]Ethereum uses the Keccak-256 hash function (as per version 3 of the winning entry to the SHA-3 contest by Bertoni et al., which is different from the final SHA-3 specification).[78]
See also
[edit]- Ethash – another Keccak-based hash
References
[edit]- ^ a b c Bertoni, Guido; Daemen, Joan; Peeters, Michaël; van Assche, Gilles (May 29, 2012). "Keccak implementation overview" (PDF). p. 25. Retrieved March 27, 2023.
- ^ Morawiecki, Paweł; Pieprzyk, Josef; Srebrny, Marian (2013). "Rotational Cryptanalysis of Round-Reduced Keccak" (PDF). In Moriai, S (ed.). Fast Software Encryption. Fast Software Encryption Lecture Notes in Computer Science. Vol. 8424. pp. 241–262. doi:10.1007/978-3-662-43933-3_13. ISBN 978-3-662-43932-6. Archived (PDF) from the original on January 8, 2013. Retrieved February 8, 2019.
- ^ Bertoni, Guido; Daemen, Joan; Peeters, Michaël; van Assche, Giles (January 14, 2011). "The Keccak SHA-3 submission" (PDF). keccak.team. Archived (PDF) from the original on August 19, 2011. Retrieved March 27, 2023.
- ^ Computer Security Division, Information Technology Laboratory (January 4, 2017). "Hash Functions | CSRC | CSRC". CSRC | NIST. Retrieved April 19, 2024.
- ^ a b "Hash Functions". NIST. June 22, 2020. Retrieved February 17, 2021.
- ^ a b c d e f g h i Information Technology Laboratory (August 2015). SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions (PDF). National Institute of Standards and Technology. doi:10.6028/NIST.FIPS.202. S2CID 64734386. Federal Information Processing Standard Publication 202. Retrieved February 29, 2020.
- ^ Dworkin, Morris J. (August 4, 2015). "SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions". Federal Information Processing Standards (NIST FIPS).
- ^ a b "NIST Selects Winner of Secure Hash Algorithm (SHA-3) Competition". NIST. October 2, 2012. Retrieved October 2, 2012.
- ^ Cruz, José R.C. (May 7, 2013). "Keccak: The New SHA-3 Encryption Standard". Dr. Dobbs.
- ^ Bertoni, Guido; Daemen, Joan; Peeters, Michaël; Van Assche, Gilles. "Keccak specifications summary". Retrieved March 27, 2023.
- ^ Chang, Shu-jen; Perlner, Ray; Burr, William E.; Sonmez Turan, Meltem; Kelsey, John M.; Paul, Souradyuti; Bassham, Lawrence E. (November 2012). Third-Round Report of the SHA-3 Cryptographic Hash Algorithm Competition (PDF). doi:10.6028/NIST.IR.7896. Retrieved February 29, 2020. Sections 5.1.2.1 (mentioning "tree mode"), 6.2 ("other features", mentioning authenticated encryption), and 7 (saying "extras" may be standardized in the future).
- ^ a b Bertoni, Guido; Daemen, Joan; Peeters, Michaël; Van Assche, Gilles; Van Keer, Ronny (March 13, 2014). "CAESAR submission: Ketje v1" (PDF). Retrieved February 29, 2020.
- ^ a b Bertoni, Guido; Daemen, Joan; Peeters, Michaël; Van Assche, Gilles; Van Keer, Ronny (March 13, 2014). "CAESAR submission: Keyak v1" (PDF). Retrieved February 29, 2020.
- ^ a b Bertoni, Guido; Daemen, Joan; Peeters, Michaël; van Assche, Giles. "The sponge and duplex constructions". Retrieved March 27, 2023.
- ^ Computer Security Division, Information Technology Laboratory (December 14, 2022). "NIST Transitioning Away from SHA-1 for All Applications | CSRC". CSRC | NIST. Retrieved October 9, 2024.
- ^ "Announcing Request for Candidate Algorithm Nominations for a New Cryptographic Hash Algorithm (SHA-3) Family [U.S. Federal Register Vol. 72 No. 212)]" (PDF). November 2, 2007. Archived (PDF) from the original on March 31, 2011. Retrieved July 18, 2017.
- ^ Bertoni, Guido; Daemen, Joan; Peeters, Michaël; Van Assche, Gilles. "The road from Panama to Keccak via RadioGatún" (PDF). Retrieved March 27, 2023.
- ^ KeccakReferenceAndOptimized-3.2.zip mainReference.c "The Keccak sponge function, designed by Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche. For more information, feedback or questions, please refer to our website: http://keccak.noekeon.org/Implementation[permanent dead link] by the designers, hereby denoted as "the implementer". To the extent possible under law, the implementer has waived all copyright and related or neighboring rights to the source code in this file. https://creativecommons.org/publicdomain/zero/1.0/"
- ^ Stevens, Marc; Bursztein, Elie; Karpman, Pierre; Albertini, Ange; Markov, Yarik. "The first collision for full SHA-1" (PDF). Retrieved February 23, 2017.
- ^ Leurent, Gaëtan; Peyrin, Thomas. "SHA-1 is a Shambles". Retrieved January 8, 2020.
- ^ "NIST Computer Security Division – The SHA-3 Cryptographic Hash Algorithm Competition, November 2007 – October 2012". January 4, 2017.
- ^ "Keccak parameter changes for round 2". Keccak Team. September 22, 2009. Archived from the original on November 13, 2017. Retrieved February 29, 2020.
- ^ "Simplifying Keccak's padding rule for round 3". Keccak Team. January 17, 2011. Retrieved March 27, 2023.
- ^ "SHA-3 standardization". NIST. Retrieved April 16, 2015.
- ^ National Institute of Standards and Technology (August 5, 2015). "Federal Information Processing Standards: Permutation-Based Hash and Extendable-Output Functions, etc". Retrieved August 5, 2015.
- ^ "Announcing Approval of Federal Information Processing Standard (FIPS) 202, SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions, and Revision of the Applicability Clause of FIPS 180-4, Secure Hash Standard". August 5, 2015.
- ^ Kelsey, John. "SHA3, Where We've Been, Where We're Going" (PDF). RSA Conference 2013.
- ^ Kelsey, John. "SHA3, Past, Present, and Future". CHES 2013.
- ^ a b "Abstract" (PDF). cr.yp.to.
- ^ "NIST hash forum mailing list". January 4, 2017.
- ^ "The Keccak SHA-3 submission" (PDF). January 14, 2011. Retrieved March 27, 2023.
- ^ "On 128-bit security". October 2, 2013. Retrieved March 27, 2023.
- ^ "A concrete proposal". October 2, 2013. Retrieved March 27, 2023.
- ^ a b "Schneier on Security: Will Keccak = SHA-3?". October 2013.
- ^ Crowley, Paul (October 1, 2013). "LShift: Why I support the US Government making a cryptography standard weaker". Archived from the original on March 24, 2016.
- ^ "Yes, this is Keccak!". October 4, 2013. Retrieved March 27, 2023.
- ^ "Moving Forward with SHA-3" (PDF).
- ^ NIST Computer Security Division (CSD). "SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions" (PDF). NIST.
- ^ "about 41 cycles/byte [...] represents a 40% speedup compared to an implementation using only 32-bit instructions". By formula we obtain
- ^ Bernstein, Daniel J. (January 4, 2012). "Optimization failures in SHA-3 software" (PDF). cr.yp.to. Retrieved February 29, 2020.
- ^ a b "Is SHA-3 slow?". June 12, 2017. Retrieved March 27, 2023.
- ^ Guo, Xu; Huang, Sinan; Nazhandali, Leyla; Schaumont, Patrick (August 2010), "Fair and Comprehensive Performance Evaluation of 14 Second Round SHA-3 ASIC Implementations" (PDF), NIST 2nd SHA-3 Candidate Conference: 12, retrieved February 18, 2011 Keccak is second only to Luffa, which did not advance to the final round.
- ^ ARM corporation, ARM architecture reference manual ARMv8, for ARMv8-A architecture profile, document ARM DDI 0487C.a (ID121917), https://www.arm.com
- ^ http://publibfp.dhe.ibm.com/epubs/pdf/dz9zr011.pdf p. 672
- ^ Rawat, Hemendra; Schaumont, Patrick (2017). "Vector Instruction Set Extensions for Efficient Computation of <sc>Keccak</sc>". IEEE Transactions on Computers. 66 (10): 1778–1789. doi:10.1109/TC.2017.2700795.
- ^ a b "Sakura: A Flexible Coding for Tree Hashing" (PDF). Keccak Team. 2014. Retrieved February 29, 2020.
- ^ SHA-3 Derived Functions: cSHAKE, KMAC, TupleHash and ParallelHash
This article incorporates text from this source, which is in the public domain.
- ^ "Software performance figures".
- ^ a b "Keccak Team: KangarooTwelve". Keccak Team.
- ^ a b "KangarooTwelve: fast hashing based on Keccak-p" (PDF). International Association for Cryptologic Research. 2016.
- ^ "KangarooTwelve slides presented at ACNS 2018" (PDF). Keccak Team.
- ^ "draft-irtf-cfrg-kangarootwelve-00 – KangarooTwelve". Ietf Datatracker. IETF. Retrieved January 17, 2020.
- ^ Bertoni, Guido; Daemen, Joan; Hoffert, Seth; Peeters, Michaël; Van Assche, Gilles; Van Keer, Ronny (December 29, 2016). "Farfalle: parallel permutation-based cryptography". Cryptology ePrint Archive.
- ^ Guido Bertoni; Joan Daemen; Seth Hoffert; Michaël Peeters; Gilles Van Assche; Ronny Van Keer (October 12, 2018). "The authenticated encryption schemes Kravatte-SANE and Kravatte-SANSE". Cryptology ePrint Archive.
- ^ Brassard, Gilles; Høyer, Peter; Tapp, Alain (1998). "Quantum cryptanalysis of hash and claw-free functions". Abstract. Lecture Notes in Computer Science. Vol. 1380. pp. 163–169. arXiv:quant-ph/9705002. doi:10.1007/BFb0054319. ISBN 978-3-540-64275-6. S2CID 118940551.
- ^ "Cost Analysis" (PDF). cr.yp.to.
- ^ "Collision problem" (PDF). scottaaronson.com.
- ^ "Paper" (PDF). eprint.iacr.org. 2016.
- ^ "Abstract" (PDF). eprint.iacr.org. 2017.
- ^ "NIST.gov – Computer Security Division – Computer Security Resource Center". December 29, 2016.
- ^ "Measurements table". bench.cr.yp.to.
- ^ Tao, Xie; Liu, Fanbao; Feng, Dengguo (2013). Fast Collision Attack on MD5 (PDF). Cryptology ePrint Archive (Technical report). IACR.
- ^ Stevens, Marc; Bursztein, Elie; Karpman, Pierre; Albertini, Ange; Markov, Yarik. The first collision for full SHA-1 (PDF) (Technical report). Google Research.
- Marc Stevens; Elie Bursztein; Pierre Karpman; Ange Albertini; Yarik Markov; Alex Petit Bianco; Clement Baisse (February 23, 2017). "Announcing the first SHA1 collision". Google Security Blog.
- ^ "The Keccak sponge function family". Retrieved January 27, 2016.
- ^ "openssl/openssl – kecak1600-avx512vl.pl". GitHub. Retrieved June 25, 2020.
- ^ "openssl/openssl – keccak1600-avx2.pl". GitHub. November 2021.
- ^ "openssl/openssl – keccak1600-x86_64.pl". GitHub. Retrieved June 25, 2020.
- ^ "openssl/openssl – keccak1600-armv8.pl". GitHub. November 2021.
- ^ "openssl/openssl – keccak1600-ppc64.pl". GitHub. Retrieved June 25, 2020.
- ^ "openssl/openssl – kccak1600-mmx.pl". GitHub. Retrieved June 25, 2020.
- ^ "llvm/llvm-project – AArch64.td". GitHub. Retrieved June 24, 2020.
- ^ "ARMv8 – ARM – WikiChip". en.wikichip.org. Retrieved June 24, 2020.
- ^ "weidai11/cryptopp". GitHub. Retrieved June 25, 2020.
- ^ "openssl/openssl". GitHub. Retrieved June 25, 2020.
- ^ "openssl/openssl". GitHub. November 2021.
- ^ "apple/llvm-project – lib/Target/AArch64/AArch64SVEInstrInfo.td". GitHub. Retrieved June 25, 2020.
- ^ IBM z/Architecture Principles of Operation, publication number SA22-7832. See KIMD and KLMD instructions in Chapter 7.
- ^ Solomon 2019, p. 62.
Sources
[edit]- Solomon, M.G. (2019). Ethereum For Dummies. Wiley. ISBN 978-1-119-47411-1. Retrieved November 20, 2024.
External links
[edit]- The Keccak web site
- SHA-3 Standard
- SHA-3 in Excel - Example implementation and demonstration in Excel (without macros) by Tim Wambach.
SHA-3
View on GrokipediaHistory
NIST Hash Function Competition
In response to significant cryptanalytic advances, including practical collision attacks on MD5 and reduced security margins for SHA-1 published in 2004, NIST began planning a successor hash function family to serve as a robust alternative to SHA-2 in anticipation of potential future weaknesses.[7] This effort was formalized through public workshops held by NIST in October-November 2005 and August 2006, which gathered input from the cryptographic community on the status of existing hash algorithms and the requirements for a new standard.[8] On November 2, 2007, NIST launched an international open competition to select SHA-3, soliciting nominations for a primary candidate algorithm along with up to two optional alternates, with submissions required to include detailed specifications, security analysis, and reference implementations supporting hash outputs of 224, 256, 384, and 512 bits.[9] By the submission deadline in October 2008, NIST received 64 entries from teams worldwide, of which 51 complete and compliant algorithms were accepted for evaluation in Round 1, beginning in December 2008.[4] The evaluation process focused on three primary criteria: security properties, including collision resistance, preimage resistance, and second preimage resistance at levels comparable to or exceeding those of SHA-2; performance across software and hardware platforms, measured by speed and resource efficiency; and design attributes such as flexibility for additional uses (e.g., as a pseudorandom function or message authentication code) and simplicity for cryptanalytic review.[10] The competition proceeded in three rounds: Round 1 (2008-2009) involved broad initial testing of all 51 candidates to identify weaknesses and gather performance data; Round 2 (2009-2010) advanced 14 algorithms for deeper analysis, including refined security evaluations and implementation optimizations; and Round 3 (2010-2011) focused intensively on the five finalists—BLAKE, Grøstl, JH, Keccak, and Skein—through extensive cryptanalysis, benchmarking, and public commentary.[4] Among the finalists, Keccak's sponge-based design particularly excelled, offering exceptional flexibility for variable output lengths and strong performance in hardware implementations, which contributed to its standout position in the final assessments.[4]Selection and Standardization
In October 2012, following the conclusion of Round 3 evaluations in December 2011, the National Institute of Standards and Technology (NIST) announced Keccak as the winner of the SHA-3 Cryptographic Hash Algorithm Competition.[5][6] NIST selected Keccak over other finalists, such as BLAKE and Skein, due to its superior security margins against potential attacks, excellent hardware efficiency, and the innovative sponge construction that offered greater flexibility compared to traditional Merkle-Damgård-based designs.[5] The standardization process began with the publication of a draft Federal Information Processing Standard (FIPS) 202 in May 2014, which outlined SHA-3 as a family of permutation-based hash functions and extendable-output functions derived from Keccak.[11] The final version of FIPS 202 was approved and released on August 5, 2015, formally defining the SHA-3 specifications.[12] This standard specified the use of the Keccak-f permutation, with tailored rates (r) for different output sizes to balance security and performance; for example, SHA3-512 employs a rate of 576 bits and a capacity of 1024 bits.[1] Upon release, FIPS 202 was integrated into U.S. federal cryptographic standards, with NIST recommending its use alongside SHA-2 for applications requiring high assurance, as part of broader cryptographic transitions away from vulnerable algorithms like SHA-1.[13] To support implementation and validation, NIST released early test vectors in conjunction with draft specifications starting in 2013, culminating in formal validation programs through the Cryptographic Algorithm Validation Program (CAVP) by 2015.[14] The first SHA-3 validations under CAVP were achieved in October 2016, marking initial widespread adoption.[15]Weakening Controversy
The weakening controversy surrounding SHA-3 emerged in late 2012 and intensified in 2013, largely fueled by revelations from Edward Snowden about the National Security Agency's (NSA) historical efforts to insert a backdoor into the Dual_EC_DRBG random number generator standard, which had been promoted by NIST despite known weaknesses.[16] These disclosures raised broader suspicions about potential NSA influence on cryptographic standards, including the ongoing finalization of SHA-3 based on the Keccak algorithm.[17] In October 2013, cryptographer Bruce Schneier publicly questioned NIST's proposed modifications to Keccak's parameters, suggesting they might favor hardware implementations potentially aligned with NSA interests, especially given the agency's documented attempts to weaken encryption standards.[18] Schneier highlighted that NIST's draft reduced Keccak's capacity (c) to improve software performance by about 30%, without altering the core permutation, but argued this adjustment prioritized speed over security margins and eroded trust in the standardization process amid the Snowden leaks.[18] Specific concerns included a shift toward larger rates (bitrates) at the expense of reduced capacity, which some feared could facilitate linear cryptanalysis by emphasizing full-state operations over efficient absorption.[18] NIST responded in November 2013 when John Kelsey, a lead on the SHA-3 project, announced via email to the cryptographic community that the agency would revert to Keccak's original parameter choices, such as setting capacity c = 2d (where d is the output length) for drop-in SHA-2 replacements, to restore confidence and avoid any perception of reduced security.[19] The Keccak team affirmed that the core algorithm remained unchanged and that the initial parameter tweaks had been suggested by them post-selection to balance performance and security, with no evidence of external tampering or deliberate weakening.[20] Cryptographer Jean-Philippe Aumasson, in subsequent analyses, concurred that exhaustive reviews found no signs of intentional flaws, though the final parameters for SHA3-512 retained the original submission's r=576 (with c=1024), rather than NIST's proposed r=1088 (with c=512), enhancing security margins at the cost of speed. The controversy led to temporary hesitation in SHA-3 adoption, with some developers and organizations opting to stick with SHA-2 amid trust concerns, but it was largely resolved by 2015 following community verifications, independent audits, and NIST's publication of FIPS 202 without the disputed parameters.[6] This episode underscored the sponge construction's flexibility in parameter selection but ultimately reinforced SHA-3's integrity through transparent adjustments.[20]Design Principles
Sponge Construction
The sponge construction is a permutation-based mode of operation that enables the creation of cryptographic functions, such as hash functions, with variable-length inputs and outputs from a fixed-width underlying permutation. It processes data by iteratively applying the permutation to a state of fixed width bits, where , with denoting the bitrate (the size of input/output blocks) and the capacity (the portion of the state that remains internal and contributes to security). In the context of SHA-3, the underlying permutation is Keccak-f{{grok:render&&&type=render_inline_citation&&&citation_id=1600&&&citation_type=wikipedia}}, fixing bits, allowing flexible choices of and to balance rate and security for different instances.[1] The construction operates in two main phases: absorption and squeezing. During absorption, the input message is first padded to a multiple of bits and then divided into blocks of bits each. The state is initialized to zeros, and for each input block , the first bits of the state are XORed with , followed by applying the permutation to the entire state; this repeats until all blocks are processed.[21] The squeezing phase then extracts output by XORing the first bits of the state into the output stream, applying the permutation, and repeating this process iteratively until the required output length is achieved.[21] For SHA-3 hash functions, the squeezed output is truncated to the specified digest length , while for extendable-output functions (XOFs) like SHAKE, it continues until an arbitrary length.[1] The algorithm can be described in pseudocode as follows:Initialize state S as a b-bit string of zeros (b = 1600 for SHA-3).
// Absorption phase
for i = 0 to length(padded_message)/r - 1:
Mi = padded_message[i*r : (i+1)*r]
S[0:r] ^= Mi // XOR input block into first r bits
f(S) // Apply Keccak-f[1600] permutation
// Squeezing phase
Z = empty string
while length(Z) < required_output_length:
Z += S[0:r] // XOR first r bits to output
f(S) // Apply permutation
Output = truncate(Z, required_output_length)
Initialize state S as a b-bit string of zeros (b = 1600 for SHA-3).
// Absorption phase
for i = 0 to length(padded_message)/r - 1:
Mi = padded_message[i*r : (i+1)*r]
S[0:r] ^= Mi // XOR input block into first r bits
f(S) // Apply Keccak-f[1600] permutation
// Squeezing phase
Z = empty string
while length(Z) < required_output_length:
Z += S[0:r] // XOR first r bits to output
f(S) // Apply permutation
Output = truncate(Z, required_output_length)
Padding Scheme
The padding scheme employed in SHA-3 is the multi-rate padding (MRP) rule, also denoted as pad101. Domain separation is achieved by first appending a suffix to the message: the 2-bit string '01' for the fixed-length SHA-3 hash functions and the 4-bit string '1111' for the SHAKE extendable-output functions (XOFs). The resulting bit string N is then padded using pad101: append a '1' bit, followed by the smallest number m ≥ 0 of '0' bits, followed by another '1' bit, such that the length of N || '1' || 0^m || '1' is a multiple of the rate r.[1] In byte-oriented implementations for byte-aligned messages, this is equivalent to appending padding bytes starting with 0x06 for SHA-3 (incorporating the '01' suffix and initial padding '1') or 0x1F for SHAKE ('1111' followed by '1'), followed by the appropriate number of 0x00 bytes, and ending with 0x80 (representing the final '1' bit followed by zeros to complete the byte).[1] For instance, consider the message "abc" (3 bytes, 24 bits) with r = 1088 bits (136 bytes) for SHA3-256: append the '01' suffix (total 26 bits), then '1', followed by 1060 '0' bits, then '1' (total 1088 bits). In bytes: append 0x06, followed by 131 bytes of 0x00, then 0x80.[1] The rationale behind this scheme is to guarantee injectivity of the padding function, prevent length-extension attacks, and enable secure operation across varying rates in the sponge family.[23] Pseudocode for the padding operation (bit-oriented) is as follows:suffix = '01' // for SHA-3; '1111' for SHAKE
N = M || suffix
ell = length(N)
z = r - (ell % r)
if z < 2:
z += r
pad = '1' || '0'^(z-2) || '1'
padded_message = N || pad
suffix = '01' // for SHA-3; '1111' for SHAKE
N = M || suffix
ell = length(N)
z = r - (ell % r)
if z < 2:
z += r
pad = '1' || '0'^(z-2) || '1'
padded_message = N || pad
Keccak-f Permutation
The Keccak-f permutation, denoted as Keccak-f, is a family of cryptographic permutations operating on a state of b bits, where b takes values 25, 50, 100, 200, 400, 800, or 1600; the SHA-3 standard employs Keccak-f with its 1600-bit state. This permutation is iterated a fixed number of rounds, with the round count n_r = 12 + 2l where b = 25 \times 2^l, yielding 24 rounds for b=1600 (l=6). Each round applies a sequence of five transformations—θ, ρ, π, χ, and ι—to achieve diffusion and non-linearity across the state.[24] The state A is structured as a 5 \times 5 \times w three-dimensional array over GF(2), where w = b/25 is the width of each lane in bits (w=64 for b=1600, resulting in 25 lanes of 64 bits). Coordinates are denoted (x, y, z) with x, y \in {0, 1, 2, 3, 4} and z \in {0, \dots, w-1}, representing lanes along the z-axis and slices in the x-y plane. This representation facilitates bit-parallel operations and supports the permutation's design for efficient mixing.[24] The θ step ensures linear diffusion by first computing column parities C[x, z] = \bigoplus_{y=0}^{4} A[y, x, z] for each x, z, then deriving D[x, z] = C[(x-1) \mod 5, z] \oplus C[(x+1) \mod 5, (z-1) \mod w], and updating every bit as A'[x, y, z] = A[x, y, z] \oplus D[x, z]. This operation mixes information across entire columns and adjacent slices, providing strong avalanche effects.[24] Following θ, the ρ step applies intra-lane rotations to distribute bits within each lane: the lane at position (x, y) is rotated left by a fixed amount r[x, y] bits along the z-axis, where the offsets form a specific pattern starting with r = 0, r[25] = 1, r[26] = 62, r[27] = 28, r[28] = 27, and subsequent values derived iteratively (e.g., r[26] = 36, r[25][26] = 44). These rotations, chosen to avoid fixed points and promote cycle coverage, enhance bit-level diffusion.[24] The π step then permutes the lane positions in the x-y plane without altering bits within lanes: A'[x, y, z] = A[y, (2x + 3y) \mod 5, z] for all x, y, z. This rearrangement ensures that subsequent operations mix data across previously independent parts of the state.[24] Non-linearity is introduced by the χ step, applied row-wise: for each fixed y and z, the five bits A[x, y, z] (x=0 to 4) are transformed as where \neg denotes bitwise NOT and \land bitwise AND; this mimics a 5-bit S-box with algebraic degree 2, providing resistance to algebraic attacks.[24] The ι step concludes each round by XORing a round-specific constant into the central lane at (0,0): A'[0, 0, z] \leftarrow A'[0, 0, z] \oplus RC[ir] for round index ir = 0 to 23 and z=0 to 63, leaving other lanes unchanged. The constants RC[ir] are the first 64 bits of the binary expansion of \pi/2 + 1 over GF(2^8) using the primitive polynomial x^8 + x^6 + x^5 + x^4 + 1 = 0 (0x171), generated via an LFSR starting from the least significant bit. This breaks symmetry and prevents slide attacks.[24] The overall structure of Keccak-f leverages the wide-trail strategy, combining the invertible linear layers (θ, ρ, π) for rapid diffusion with the nonlinear χ layer to thwart differential and linear cryptanalysis, ensuring high security margins across the full 24 rounds.[24]Specifications
State and Block Operations
The SHA-3 algorithms operate on a fixed-width state of 1600 bits, denoted as , which is initialized to all zeros at the start of processing.[1] This state is divided into a rate portion of bits and a capacity portion of bits, where determines the block size for input absorption and output squeezing.[1] The input message is first processed through a padding scheme to ensure its length is a multiple of bits, producing a padded message consisting of full -bit blocks.[1] In the absorption phase, each full block is XORed into the first bits (the rate portion) of the state , after which the full 1600-bit permutation function Keccak-f{{grok:render&&&type=render_inline_citation&&&citation_id=1600&&&citation_type=wikipedia}} is applied to the entire state.[1] This process repeats for all blocks except possibly the last; if the final block is partial, it is padded to bits before XORing into the state, followed by the permutation.[1] The absorption loop continues until the entire padded message has been incorporated into the state. Following absorption, the squeezing phase extracts the desired output of bits (the hash length for fixed-output SHA-3 instances).[1] The first bits of the state are taken as an output block, and the permutation is applied to the state; this is repeated until at least bits are obtained, after which the leftmost bits form the final hash value.[1] For SHA-3 instances, where , squeezing typically requires only the initial rate portion after the final absorption permutation, truncated to bits, without additional permutations.[1] The state uses a specific bit-ordering convention to map input bytes to the 1600-bit array, represented as a 5×5 array of 64-bit lanes.[1] Lanes employ little-endian ordering for both bits (least significant bit at position 0 within the lane) and bytes (least significant byte at the lowest address).[1] This ensures consistent loading of input data into the state during XOR operations. The complete SHA-3 hashing process can be expressed in pseudocode as follows, adapted from the sponge construction:function SHA3(M, r, d):
S ← 0^{1600} // Initialize 1600-bit state to zero
M_padded ← pad_{10*1}(M || '00000110') // Append domain separator 0x06 (as bits) then apply padding
for each r-bit block B in M_padded:
S[0:r] ← S[0:r] XOR B // XOR block into rate portion
S ← Keccak-f[1600](S) // Apply full-state permutation
Z ← "" // Initialize output string
while len(Z) < d:
Z ← Z || S[0:r] // Append first r bits of state
S ← Keccak-f[1600](S) // Apply permutation for next block
if len(Z) > d:
Z ← leftmost d bits of Z // Truncate if exceeded
return Z
function SHA3(M, r, d):
S ← 0^{1600} // Initialize 1600-bit state to zero
M_padded ← pad_{10*1}(M || '00000110') // Append domain separator 0x06 (as bits) then apply padding
for each r-bit block B in M_padded:
S[0:r] ← S[0:r] XOR B // XOR block into rate portion
S ← Keccak-f[1600](S) // Apply full-state permutation
Z ← "" // Initialize output string
while len(Z) < d:
Z ← Z || S[0:r] // Append first r bits of state
S ← Keccak-f[1600](S) // Apply permutation for next block
if len(Z) > d:
Z ← leftmost d bits of Z // Truncate if exceeded
return Z
Defined Instances
The SHA-3 standard defines four primary fixed-output hash functions: SHA3-224, SHA3-256, SHA3-384, and SHA3-512. These instances are based on the Keccak sponge construction with a fixed width of 1600 bits, where the rate and capacity satisfy . The parameters for each instance are selected to provide specific output lengths and security strengths, with the capacity set to (where is the output length in bits) to achieve a security level of bits against collision and preimage attacks. The following table summarizes the parameters for the defined SHA-3 instances:| Instance | Output Length (bits) | Rate (bits) | Capacity (bits) | Security Level (bits) |
|---|---|---|---|---|
| SHA3-224 | 224 | 1152 | 448 | 112 |
| SHA3-256 | 256 | 1088 | 512 | 128 |
| SHA3-384 | 384 | 832 | 768 | 192 |
| SHA3-512 | 512 | 576 | 1024 | 256 |
a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a, as specified in the NIST test vectors.[14]
Extendable-Output Functions
SHA-3 includes two extendable-output functions (XOFs), SHAKE128 and SHAKE256, which generalize the fixed-output hash functions by allowing arbitrary output lengths while maintaining the sponge construction. SHAKE128 operates with a capacity bits and rate bits, providing 128 bits of security against preimage, second-preimage, and collision attacks when the output length is sufficiently large (specifically, bits for full security). Similarly, SHAKE256 uses bits and bits, offering 256 bits of security under the same conditions. These parameters ensure that the functions behave as pseudorandom functions for outputs up to the state size of 1600 bits, with domain separation achieved by appending the 4-bit string 1111 (equivalent to the byte 0x1F in the padding scheme) to the input message before processing.[29] The computation of a SHAKE function begins with absorbing the input message into the sponge state using the multi-rate padding rule, which incorporates the domain separator 1111 followed by the standard 10*1 padding to align with the rate . Once absorption is complete, the squeezing phase extracts output by repeatedly applying the Keccak-f permutation to the state and outputting the first bits (the rate portion) in most-significant-bit (MSB)-first order. This process continues until exactly bits are produced, without truncation or additional padding; if the final block yields more bits than needed, only the required prefix is taken. The output is thus , where the squeezing iterates times, with the last iteration possibly partial.[29][30] A customizable variant, cSHAKE, extends SHAKE by incorporating a function name (for additional domain separation) and a customization string (for application-specific personalization, such as masking or context binding). Defined in NIST SP 800-185, cSHAKE128 and cSHAKE256 use the same capacities as their SHAKE counterparts but construct the input to the underlying KECCAK as bytepad(encode_string(N) || encode_string(S), 168) || X || 00 (two zero bits) for cSHAKE128 or bytepad(..., 136) for cSHAKE256, where encode_string left-pads the input bit string to the next multiple of 8 bits, encodes its length in 8 bits (MSB first), and bytepad right-pads with zeros to the specified byte length. This is then absorbed using the XOF padding with domain separator 1111.[31] These XOFs are particularly suited for scenarios requiring variable-length outputs, such as key derivation functions (e.g., generating keys from a master secret), modeling ideal random oracles in protocol designs, and producing masks or nonces with customization to prevent cross-protocol attacks. For instance, applying SHAKE256 to the input string "email" with bits generates a 64-byte pseudorandom string suitable for email-related key derivation, demonstrating the function's flexibility beyond fixed hashes.[29][31]Performance
Software Speed Benchmarks
Software implementations of SHA-3 exhibit performance that varies significantly across CPU architectures, primarily measured in cycles per byte (cpb) for processing large messages, where lower values indicate higher speed. On Intel Skylake processors, optimized SHA3-256 implementations achieve approximately 6.4 to 9.0 cpb using AVX2 or AVX512 instructions, while SHA3-512 reaches about 14.8 cpb on standard Skylake and 11.0 cpb on Skylake-X variants.[32][33] In contrast, on ARM Cortex-A57 processors, unoptimized SHA3-256 implementations require around 101 cpb, though optimizations can reduce this substantially through vectorized processing.[34] Compared to SHA-2, SHA-3 is generally slower in software due to its wider permutation state (1600 bits) and sponge construction, which processes data in smaller effective block sizes. For instance, SHA-256 achieves about 7.6 cpb on Skylake, roughly half the cost of SHA3-256 in typical scenarios, highlighting SHA-3's trade-off for enhanced security properties over raw speed on general-purpose CPUs.[32] Key optimization techniques for SHA-3 software include bitslicing to enable parallelism across multiple lanes of the Keccak permutation and the use of assembly intrinsics for steps like θ (parity computation) and χ (non-linear mapping), which leverage SIMD instructions such as AVX2 or AVX512 to process up to 8 or 16 lanes simultaneously.[35] Benchmarks as of 2023 on Apple M1 processors show SHA3-512 achieving around 8 cpb with Neon vectorization, benefiting from the architecture's efficient 128-bit SIMD units, while AVX-512 on Intel CPUs further reduces cpb for SHA3-256 to under 7 on Skylake-X.[36][33] As of 2024, OpenSSL 3.0+ provides SHA-3 support with SHA3-256 throughput of approximately 509 MB/s on large messages using modern AMD EPYC processors (e.g., Zen 3/4 cores at 3-4 GHz), translating to 6-15 cpb depending on clock speed and optimizations.[37] In popular libraries, OpenSSL 3.0 provides SHA-3 support with SHA3-256 throughput of approximately 200-460 MB/s on modern Intel CPUs (e.g., 3-4 GHz cores), translating to 6-15 cpb depending on clock speed and optimizations; libsodium, while primarily focused on BLAKE2, includes SHA-3 via wrappers but prioritizes faster alternatives for high-performance needs.[37] Performance is influenced by the rate parameter r (block absorption size, e.g., 1088 bits for SHA3-256) and the fixed 24 rounds of the Keccak-f permutation per full state update, where smaller r leads to more frequent padding and slower effective throughput for short messages.Hardware Implementations
Hardware implementations of SHA-3 leverage the Keccak permutation's inherent suitability for dedicated circuits, offering efficient area-throughput trade-offs across application-specific integrated circuits (ASICs) and field-programmable gate arrays (FPGAs). The design's simple round functions—primarily bitwise XOR, AND, NOT operations, and rotations—eliminate the need for complex components like large S-boxes found in AES, enabling compact and low-power realizations.[38] Additionally, the 1600-bit state organized into 25 parallel 64-bit lanes facilitates efficient pipelining and concurrent processing, boosting throughput without excessive resource demands.[38] These attributes position SHA-3 as a strong candidate for resource-constrained environments, outperforming SHA-2 in hardware efficiency by approximately two to two and a half times in speed-area metrics.[39] Compact implementations of the Keccak-f permutation typically achieve 2-3 gate equivalents (GE) per bit of state, balancing minimal area with acceptable performance for embedded systems.[40] For instance, serialized designs minimize logic usage for low-power applications, while unrolled variants trade higher area for elevated throughputs on older process nodes.[40] High-speed configurations push boundaries further, with fully unrolled architectures attaining up to 100 Gbps on advanced nodes, ideal for high-performance networking applications.[40] These trade-offs are influenced by factors like rounding strategy and process technology, allowing designers to optimize for specific constraints such as power or latency.[35] On FPGAs, SHA-3 implementations demonstrate versatility through serialized and unrolled architectures. A serialized design for SHA-3-256 on Xilinx Virtex-7 operates at 500 MHz, delivering approximately 200 MB/s throughput with modest resource usage (around 5k LUTs), suitable for balanced performance.[41] In contrast, unrolled versions achieve higher speeds—up to 18 Gbps on similar platforms—but consume significantly more slices (e.g., 10k+ LUTs), highlighting the throughput-area continuum.[39] These benchmarks underscore SHA-3's adaptability to reconfigurable hardware, where parallel lane processing exploits FPGA parallelism effectively.[35] ASIC examples emphasize low-power scenarios, particularly for Internet of Things (IoT) devices. In a 65nm process, serialized Keccak implementations prioritize energy efficiency over speed for battery-constrained nodes.[42] Such designs benefit from Keccak's uniform operations, which simplify synthesis and reduce dynamic power compared to table-driven hashes.[40] Regarding standardization, while NIST's lightweight cryptography project selected ASCON—a sponge-inspired primitive—as its primary standard, Keccak-based SHA-3 variants remain relevant for lightweight hashing in constrained protocols due to their proven hardware efficiency. ASCON serves as a more compact alternative to full SHA-3, but Keccak's modularity supports tailored instances for emerging standards.[43] Advances as of 2024 have continued to focus on side-channel resistance, with threshold implementations reducing clock cycles for first-order masked SHA-3 designs. These techniques decompose operations into shares to thwart power analysis attacks, achieving low-latency protected hashing with minimal overhead—e.g., 20% area increase for full security—while maintaining throughputs above 1 Gbps on modern FPGAs.[41] Such innovations enhance SHA-3's deployability in secure hardware ecosystems. Additionally, as of 2025, custom SHA-3 instructions in general-purpose processors show potential for further software-hardware co-optimization on ARM and x86 architectures.[44][35]| Platform | Design Type | Process/FPGA | Area (GE or LUTs) | Clock Freq. (MHz) | Throughput (SHA-3-256) |
|---|---|---|---|---|---|
| FPGA | Serialized | Virtex-7 | ~5k LUTs | 500 | 200 MB/s |
| FPGA | Unrolled | Virtex-6 | ~10k LUTs | 250 | 18 Gbps |
Security
Classical Attack Resistance
SHA-3, based on the Keccak sponge construction, provides collision resistance of bits, where is the output length. For the SHA3-512 instance, with bits and capacity bits, this yields a collision resistance of , matching the birthday bound for its 512-bit output length, and no practical breaks have been found despite extensive cryptanalysis.[2] The construction also offers first preimage resistance of bits and second preimage resistance of bits, supported by the underlying Keccak-f permutation's resistance to linear and differential cryptanalytic trails. The permutation's design, including the non-linear step and linear mixing via , ensures that low-weight differentials do not propagate efficiently across full rounds, maintaining these bounds under the assumption of an ideal permutation. Known attacks on SHA-3 are limited to reduced-round variants of the Keccak-f permutation. For instance, collision attacks have been demonstrated on up to 5 rounds. These results prompted an increase in the number of rounds during the SHA-3 competition to enhance the safety margin.[45][46] Rebound attacks and rotational cryptanalysis further illustrate the permutation's robustness, as both are confined to a few rounds due to the non-linearity of the mapping, which disrupts trail propagation. The unaligned rebound technique extends differentials to at most 8 rounds for distinguishers, while rotational attacks achieve distinguishers on up to 5 rounds but fail against the full 24 rounds. Thus, the complete Keccak-f remains secure against these methods.[47][48] SHA-3 does not inherently resist side-channel attacks such as power analysis, as its operations can leak information through implementation-specific patterns. Countermeasures like Boolean masking or threshold implementations are necessary, though they introduce significant overhead; for example, first-order masking can increase area by 3-4 times and latency accordingly in hardware realizations.[49] Provable security bounds for Keccak leverage a wide-trail strategy in the linear layer, guaranteeing at least 256 bits of diffusion per pair of rounds through the step's parity mixing, which ensures high active bit counts in any non-trivial trail. This design principle bounds the probability of differential and linear characteristics, providing strong evidence against trail-based attacks on the full permutation.Quantum Attack Considerations
SHA-3's sponge construction provides resilience against quantum attacks primarily through its large internal state and permutation-based design, which limits the effectiveness of known quantum algorithms to generic bounds. Grover's algorithm reduces the complexity of preimage attacks from to approximately operations, where is the output length; for SHA3-256 with , this yields a complexity, maintaining adequate security for post-quantum applications as 128-bit security remains computationally infeasible.[50] Similarly, second-preimage resistance follows the same Grover bound, ensuring SHA-3 variants with sufficient output sizes resist exhaustive quantum searches.[51] For collision resistance, the classical birthday paradox bound of approximately is not directly altered by Grover's algorithm, but quantum collision-finding techniques such as the Brassard-Høyer-Tapp algorithm or quantum walks can reduce the complexity to roughly . In the sponge construction, the capacity bits for SHA3-256 provides a quantum collision bound of about , but larger instances offer better margins. NIST's post-quantum recommendations affirm SHA-3's suitability, advising the use of SHA3-384 (, ) or SHA3-512 (, ) to achieve at least 128-bit quantum security levels for collision and preimage resistance.[52] Unlike linear block ciphers vulnerable to Simon's algorithm for period-finding and key recovery, SHA-3's Keccak permutation avoids such structural weaknesses due to its nonlinear sponge operations, precluding efficient quantum key-recovery attacks.[53] Studies from 2023 and 2025 confirm that no quantum attacks better than these generic bounds exist for the full-round Keccak, with analyses of reduced-round variants (e.g., 6-round collisions) not extending to the 24-round FIPS 202 specification.[54] In hybrid post-quantum schemes, SHA-3 is commonly paired with quantum-resistant digital signatures like ML-DSA or FALCON, leveraging its hash functions for key derivation and message digesting while ongoing research evaluates long-term resistance against potential full quantum breaks.Derivatives
KangarooTwelve
KangarooTwelve is a fast and secure extendable-output function (XOF) derived from the Keccak family of permutations, introduced in 2016 by Guido Bertoni, Joan Daemen, Michaël Peeters, Gilles Van Assche, and Ronny Van Keer.[55] It builds on the sponge construction underlying SHA-3 but operates using the Keccak-p[1600, 12] permutation, a reduced-round variant (12 rounds instead of 24) of the Keccak-f permutation used in SHA-3, to prioritize software performance while maintaining cryptographic security.[56] This design choice uses the same 1600-bit state size as SHA-3 but with fewer rounds, enabling higher throughput on modern processors.[55] The core design of KangarooTwelve employs a parallelizable tree hashing mode based on the Sakura encoding scheme, which processes input data in a binary tree structure with up to c parallel sponge instances, where c is a customizable parameter for the number of leaves.[55] Compression of intermediate tree nodes uses the Fiat-Shamir paradigm to absorb and combine outputs from child nodes securely.[56] The sponge instances (TurboSHAKE) operate with a rate of 1344 bits and a capacity of 256 bits for the KT256 variant (and rate of 1472 bits and capacity of 128 bits for KT128), supporting arbitrary-length outputs in XOF mode while defaulting to 256-bit digests for fixed-output hashing.[55] This structure allows efficient parallel processing of large inputs, making it suitable for high-speed applications without sacrificing the essential properties of the Keccak sponge construction. In terms of performance, KangarooTwelve achieves significantly higher speeds than SHA-3-256 in software implementations, often exceeding twice the throughput due to the reduced permutation rounds and inherent parallelism in the tree mode.[57] Benchmarks on commodity hardware demonstrate its efficiency for processing multi-gigabyte inputs, with optimized implementations leveraging SIMD instructions for further gains.[55] KangarooTwelve provides a security level of 128 bits against preimage and second-preimage attacks when the output is at least 128 bits long, and 128 bits against collisions for outputs of at least 256 bits.[55] It inherits the differential and algebraic resistance properties of Keccak but with reduced security margins owing to the smaller capacity and round count, positioning it as a balanced choice for scenarios where 128-bit security suffices.[56] Applications of KangarooTwelve include file integrity verification and other non-cryptographic hashing tasks requiring rapid computation of digests or extended outputs, such as data deduplication or checksum generation. It is not standardized by NIST in FIPS 202 but has been specified in IETF RFC 9861 alongside TurboSHAKE for broader adoption in protocols needing fast, parallelizable hashing.Farfalle Construction
The Farfalle construction, introduced in 2016 by Guido Bertoni, Joan Daemen, Seth Hoffert, Michaël Peeters, Gilles Van Assche, and Ronny Van Keer, is a permutation-based mode designed for building pseudorandom functions (PRFs) that support variable-length inputs and outputs.[58] The name "Farfalle," Italian for "butterflies," evokes the construction's incremental processing structure, which enables parallel evaluation akin to the connectivity in a butterfly network.[58] It leverages Keccak permutations, allowing reuse of the underlying Keccak-p primitive from SHA-3 for efficiency in both hashing and authenticated encryption applications.[59] At its core, Farfalle consists of three main components: a keyed rolling function (KR) for absorbing input data, a central permutation layer using Keccak-p, and a rolling output function (RO) for extracting the final output.[58] For hashing, the process begins by applying the KR to the input message, which incorporates a key and prepares the state for the permutation; the state is then transformed by multiple rounds of the Keccak-p permutation; finally, the RO "squeezes" the output incrementally as needed.[58] To support authenticated encryption with associated data (AEAD), the construction incorporates keying in the KR and RO phases, enabling secure handling of both plaintext and metadata while producing a tag for integrity verification.[58] Parameter choices include Keccak-p for higher speed in resource-constrained environments and Keccak-p for enhanced security margins, both targeting at least 128-bit security against generic attacks.[58] Farfalle offers key advantages in parallelism and robustness: its design allows independent permutation evaluations across data blocks, facilitating efficient implementation on multi-core processors or hardware accelerators.[58] Unlike traditional modes such as CBC-MAC, it provides misuse resistance, maintaining security even if nonces or keys are reused, due to the diffusion properties of the rolling functions and permutations.[58] These features make it suitable for diverse applications, including variants like the FLEET mode, which adapts Farfalle for lightweight cryptography in embedded systems requiring low-latency authenticated encryption.[58]Sakura Tree Hashing
Sakura is a flexible coding scheme for tree hashing modes, introduced in 2013 by Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles Van Assche as part of the Keccak team's efforts to extend the sponge construction for parallel processing of large inputs.[60] It employs the Keccak-f permutation in a Merkle-like tree structure to enable efficient parallelism, where the message is split into blocks processed independently at leaf nodes before being combined upward through the tree.[60] This approach allows for variable arity at internal nodes, accommodating arbitrary tree topologies while ensuring domain separation to prevent input clashes between different node types or positions.[60] In the Sakura structure, leaf nodes absorb message blocks into the sponge state via the Keccak-f permutation, producing fixed-length chaining values.[61] For internal nodes, child chaining values are concatenated with structural padding (indicating node type and position) and fed into a new sponge instance; the sponge then squeezes a value of the same length as the chaining values, which is XORed with the next child's input to form the node's output, maintaining consistency across the tree.[61] The parameters support 256-bit security levels when using an output length of at least 256 bits, inheriting the collision and preimage resistance bounds of the underlying Keccak sponge.[60] This design proves faster than sequential SHA-3 for large inputs due to its parallelizable tree evaluation, without requiring fixed sponge capacities.[55] Security properties of Sakura include inheritance of the sponge construction's capacity-based bounds against differential and algebraic attacks, with the tree mode providing resistance to second preimages equivalent to the underlying hash function's strength.[60] The encoding ensures that finding a second preimage for the root requires solving one for a leaf or internal node, preserving overall integrity.[60] Compared to the Merkle tree in RFC 6962 for certificate transparency, Sakura is simpler, omitting signature verification mechanisms and focusing solely on data integrity through hashing.[60][62] Implementations of Sakura are available open-source within the Keccak Code Package, facilitating integration into cryptographic libraries. It has been employed in experimental distributed storage systems to enhance parallel integrity checks for large-scale data.[63] Sakura's tree mode also underpins parallel extensions like KangarooTwelve, adapting the coding for specific sponge-based designs.[55]Applications and Comparisons
Protocol Usage
SHA-3 has been integrated into several cryptographic protocols and standards, particularly for hashing, digital signatures, and key derivation, as part of efforts to phase out older algorithms like SHA-1 and enhance long-term security. In the Transport Layer Security (TLS) protocol, SHA-3 support is available in TLS 1.3 implementations for use in HKDF (as a replacement for HMAC-based PRFs) and digital signature schemes, although the core specification in RFC 8446 primarily mandates SHA-256 for these purposes.[64] For TLS 1.2, SHA-3 usage remains optional through extended cipher suites and signature algorithms, enabling backward-compatible deployments in environments requiring stronger hash resistance.[65] In IPsec protocols, the National Institute of Standards and Technology (NIST) recommends the use of approved hash functions, including SHA-3 variants such as SHA3-256 or higher, for integrity protection and authentication, in line with deprecation timelines for weaker algorithms in SP 800-131A Revision 3.[66] This guidance aligns with federal requirements to use approved hashes for applications demanding resistance to length-extension attacks inherent in Merkle-Damgård constructions.[13] Blockchain platforms have incorporated SHA-3 family functions variably; Ethereum 2.0 continues to rely on Keccak-256—a pre-standardization variant of the SHA-3 design—for transaction hashing and proof-of-stake operations, without a full transition to the NIST-finalized SHA-3 due to compatibility constraints in its sponge construction and padding rules.[67] Bitcoin has explored SHA-3 in conceptual proposals for future upgrades to improve proof-of-work security and energy efficiency, though it remains anchored to SHA-256 as of 2025.[68] The extendable-output functions (XOFs) in SHA-3, particularly SHAKE128 and SHAKE256, serve as flexible alternatives to traditional key derivation functions like PBKDF2 from PKCS#5, offering variable-length outputs and domain separation without fixed iteration counts.[69] In FIPS 202, cSHAKE—a customizable variant—enables secure key derivation by incorporating customization strings to prevent cross-protocol attacks, making it suitable for diverse applications such as pseudorandom number generation and message authentication.[2] National and regional guidelines further promote SHA-3 integration; the Canadian Centre for Cyber Security's ITSP.40.111 (updated 2025, building on 2023 recommendations) recommends SHA3-256 or stronger alongside other approved hashes for hashing in unclassified and protected information systems to ensure compliance with evolving threats.[70] Similarly, the European Payments Council's guidelines on cryptographic algorithms endorse SHA-3 alongside SHA-2 for payment systems and trust services under frameworks like eIDAS 2.0, emphasizing its role in qualified electronic signatures and attribute-based credentials. By 2025, SHA-3 adoption has accelerated in new systems, with NIST public comments noting "great adoption" in specialized cryptographic applications, though it trails SHA-2 in widespread deployment due to performance considerations on legacy hardware. In March 2025, NIST announced updates to FIPS 202, including enhancements to SHA-3 functions for broader applications.[71][72]Comparison with SHA-1 and SHA-2
SHA-1 and SHA-2 both employ the Merkle–Damgård construction, in which the input message is padded to a multiple of the block size and divided into blocks that are iteratively compressed using a state-updating function. SHA-1's compression function builds on the design of MD5, incorporating 80 rounds of bitwise operations, rotations, and modular additions on a 160-bit state. In contrast, SHA-2 variants like SHA-256 use a 256-bit state with 64 rounds, featuring a more intricate compression function that includes nonlinear functions inspired by AES-like substitutions but primarily relying on bitwise AND, XOR, rotations, and additions for diffusion. SHA-3, based on the Keccak algorithm, diverges fundamentally by utilizing a sponge construction. This involves absorbing the padded message into a fixed-width state via a permutation function, followed by squeezing output bits from the state as needed; the permutation operates on a 1600-bit state through 24 rounds of substitutions, permutations, and XORs, enabling uniform treatment of input and output without a dedicated compression step. This design provides inherent resistance to certain structural weaknesses inherent in Merkle–Damgård, such as length-extension attacks, where an adversary can append data to a hash without knowing the original secret prefix.[1] Regarding security, SHA-1's collision resistance has been practically compromised; in 2017, researchers from Google and CWI demonstrated the first full collision using a differential attack requiring approximately 2^{63.2} SHA-1 computations, equivalent to about 6,500 CPU-years and 110 GPU-years on contemporary hardware. SHA-2 maintains strong classical collision resistance—128 bits for SHA-256, with no practical breaks despite extensive cryptanalysis—but remains susceptible to length-extension attacks, allowing forged extensions to HMAC-like uses if the secret is not properly isolated. SHA-3 offers comparable collision resistance (128 bits for SHA3-256) with higher margins against known attacks and eliminates length-extension vulnerabilities through its sponge paradigm, which treats the entire input holistically without intermediate chaining.[73][74][1] All three families support fixed output sizes of 224, 256, 384, or 512 bits to align with legacy applications, but SHA-3 uniquely includes extendable-output functions (XOFs) such as SHAKE128 and SHAKE256, which can produce arbitrary-length outputs from a single instance, enhancing flexibility for applications like key derivation without truncation risks.[1] Performance varies by platform: in software on x86-64 architectures, SHA-256 is typically 3–4 times faster than SHA3-256 for large inputs due to optimized vector instructions and simpler operations, achieving throughputs around 1,770 MB/s versus 510 MB/s on an AMD EPYC processor. SHA-1, while historically fast, is deprecated and no longer recommended. In hardware, SHA-3 excels in efficiency, often requiring fewer gate equivalents (GE) for comparable throughput; for instance, compact SHA3-256 implementations use about 4,000–6,000 GE, compared to 10,000–15,000 GE for SHA-256, making it preferable for resource-constrained devices like smart cards.[37]| Aspect | SHA-1 | SHA-256 | SHA3-256 |
|---|---|---|---|
| Design Type | Merkle–Damgård | Merkle–Damgård | Sponge |
| Collision Strength (bits) | 80 (broken ~63) | 128 | 128 |
| Software CPB (x86, approx.) | ~5–10 | ~10–15 | ~30–40 |
| Hardware GE (approx., compact) | ~12,000 | ~12,000–15,000 | ~4,000–6,000 |
Recent Updates
NIST Revisions to FIPS 202
In September 2024, NIST's Crypto Publication Review Board proposed updates to Federal Information Processing Standard (FIPS) 202, the SHA-3 Standard, and revisions to Special Publication (SP) 800-185, SHA-3 Derived Functions: cSHAKE, KMAC, TupleHash, and ParallelHash, in response to public comments received during an initial review process that began in July 2023.[76] The proposal sought to address feedback on implementation aspects, with a public comment period open from September 4 to October 7, 2024, during which stakeholders provided input on clarity and guidance.[71] On March 12, 2025, NIST announced the final decision to implement these updates following the two public comment periods, incorporating feedback focused on editorial clarity and errata corrections, while confirming no changes to the core SHA-3 algorithm or its underlying Keccak permutation.[77] Key revisions to FIPS 202 emphasize improved editorial quality and updated references to deprecated algorithms like SHA-1 and Triple DES to align with their current non-recommended status in federal systems.[77] Revisions to SP 800-185 include enhanced specifications for the extendable-output functions (XOFs) SHAKE128 and SHAKE256, introducing "streaming" modes to support implementations with incomplete input or output data, along with additional technical and editorial changes from public comments.[77] The revisions address minor ambiguities identified in the original 2015 FIPS 202, such as inconsistent terminology and implementation guidance, thereby facilitating more robust adoption in federal systems.[2] As of November 2025, drafts of the updated standards are pending release for public comment.[77]New Implementation Advances
Recent advances in SHA-3 implementations have focused on enhancing security, performance, and adaptability for diverse environments, particularly through novel architectural designs and integrations with emerging cryptographic needs. In 2023, researchers proposed a seed-value modification to the SHA-3 hash function by XORing a transformed seed value with the result of the θ step in the last round of the Keccak permutation to enhance diffusion properties. This approach aims to reduce bias in output patterns while maintaining core security properties including collision, preimage, and second preimage resistance, as validated by NIST statistical test suite.[78] Hardware optimizations have also progressed, with a 2023 study introducing a novel FPGA-based architecture for the Keccak core underlying SHA-3, which reduces the total clock cycles required for hashing through efficient pipelining and resource sharing. This design achieves throughput rates up to 38 Gbps in simulations on modern FPGAs, while maintaining low area utilization suitable for embedded systems. Such advancements enable faster processing in bandwidth-intensive applications like secure data streaming.[41] In the realm of post-quantum cryptography, a 2025 IEEE publication detailed optimizations for integrating masked SHA-3 into ML-KEM, a lattice-based key encapsulation mechanism standardized by NIST. The hybrid design enhances key derivation processes by accelerating first-order side-channel-resistant SHA-3 operations within the lattice framework, reducing overhead in randomness generation and masking costs while preserving 128-bit security levels against quantum threats. This masked accelerator demonstrates up to 30% improvement in cycle counts for full ML-KEM operations on hardware, facilitating secure key exchange in quantum-vulnerable environments.[79]References
- A cryptographic hash algorithm (alternatively, hash "function") is designed to provide a random mapping from a string of binary data to a fixed-size “message ...
- The SHA-3 family consists of four cryptographic hash functions, called SHA3-224,. SHA3-256, SHA3-384, and SHA3-512, and two extendable-output functions (XOFs),.
- Nov 15, 2012 · The competition was NIST's response to advances in the cryptanalysis of hash algorithms. NIST received sixty-four submissions in October 2008, ...
- The SHA-3 family consists of four cryptographic hash functions, called SHA3-224, SHA3-256, SHA3-384, and SHA3-512, and two extendable-output functions (XOFs), ...
