SHA-3 (Secure Hash Algorithm 3) is the latest member of the
Secure Hash Algorithm family of standards, released by
NIST
The National Institute of Standards and Technology (NIST) is an agency of the United States Department of Commerce whose mission is to promote American innovation and industrial competitiveness. NIST's activities are organized into physical s ...
on August 5, 2015.
Although part of the same series of standards, SHA-3 is internally different from the
MD5
The MD5 message-digest algorithm is a widely used hash function producing a 128-bit hash value. MD5 was designed by Ronald Rivest in 1991 to replace an earlier hash function MD4, and was specified in 1992 as Request for Comments, RFC 1321.
MD5 ...
-like
structure
A structure is an arrangement and organization of interrelated elements in a material object or system, or the object or system so organized. Material structures include man-made objects such as buildings and machines and natural objects such as ...
of
SHA-1
In cryptography, SHA-1 (Secure Hash Algorithm 1) is a hash function which takes an input and produces a 160-bit (20-byte) hash value known as a message digest – typically rendered as 40 hexadecimal digits. It was designed by the United States ...
and
SHA-2
SHA-2 (Secure Hash Algorithm 2) is a set of cryptographic hash functions designed by the United States National Security Agency (NSA) and first published in 2001. They are built using the Merkle–Damgård construction, from a one-way compression ...
.
SHA-3 is a subset of the broader cryptographic primitive family Keccak ( or ),
designed by
Guido Bertoni,
Joan Daemen
Joan Daemen (; born 1965) is a Belgians, Belgian cryptographer who is currently professor of digital security (symmetric encryption) at Radboud University. He co-designed with Vincent Rijmen the Rijndael cipher, which was selected as the Advance ...
,
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
Authenticated Encryption (AE) is an encryption scheme which simultaneously assures the data confidentiality (also known as privacy: the encrypted message is impossible to understand without the knowledge of a secret key) and authenticity (in othe ...
system, a "tree" hashing scheme for faster hashing on certain architectures, and
AEAD ciphers Keyak and Ketje.
Keccak is based on a novel approach called
sponge construction.
Sponge construction is based on a wide random function or random
permutation
In mathematics, a permutation of a set can mean one of two different things:
* an arrangement of its members in a sequence or linear order, or
* the act or process of changing the linear order of an ordered set.
An example of the first mean ...
, 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, NIST does not plan to withdraw SHA-2 or remove it from the revised Secure Hash Standard. 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.
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
The Keccak algorithm is the work of Guido Bertoni,
Joan Daemen
Joan Daemen (; born 1965) is a Belgians, Belgian cryptographer who is currently professor of digital security (symmetric encryption) at Radboud University. He co-designed with Vincent Rijmen the Rijndael cipher, which was selected as the Advance ...
(who also co-designed the
Rijndael
The Advanced Encryption Standard (AES), also known by its original name Rijndael (), is a specification for the encryption of electronic data established by the U.S. National Institute of Standards and Technology (NIST) in 2001.
AES is a variant ...
cipher with
Vincent Rijmen
Vincent Rijmen (; born 16 October 1970) is a Belgium, Belgian cryptographer and one of the two designers of the Rijndael, the Advanced Encryption Standard. Rijmen is also the co-designer of the WHIRLPOOL cryptographic hash function, and the block ...
), Michaël Peeters, and
Gilles Van Assche. It is based on earlier hash function designs
PANAMA
Panama, officially the Republic of Panama, is a country in Latin America at the southern end of Central America, bordering South America. It is bordered by Costa Rica to the west, Colombia to the southeast, the Caribbean Sea to the north, and ...
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. The
reference implementation
In the software development process, a reference implementation (or, less frequently, sample implementation or model implementation) is a program that implements all requirements from a corresponding specification. The reference implementation ...
source code
In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer.
Since a computer, at base, only ...
was dedicated to
public domain
The public domain (PD) consists of all the creative work to which no Exclusive exclusive intellectual property rights apply. Those rights may have expired, been forfeited, expressly Waiver, waived, or may be inapplicable. Because no one holds ...
via
CC0 waiver
A waiver is the voluntary relinquishment or surrender of some known right or privilege.
A waiver is often written, such as a disclaimer that has been accepted, but it may also be spoken between two or more parties. When the right to hold a ...
.
In 2006,
NIST
The National Institute of Standards and Technology (NIST) is an agency of the United States Department of Commerce whose mission is to promote American innovation and industrial competitiveness. NIST's activities are organized into physical s ...
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
SHA-2 (Secure Hash Algorithm 2) is a set of cryptographic hash functions designed by the United States National Security Agency (NSA) and first published in 2001. They are built using the Merkle–Damgård construction, from a one-way compression ...
, as no significant attack on SHA-2 has been publicly demonstrated . Because of the successful attacks on
MD5
The MD5 message-digest algorithm is a widely used hash function producing a 128-bit hash value. MD5 was designed by Ronald Rivest in 1991 to replace an earlier hash function MD4, and was specified in 1992 as Request for Comments, RFC 1321.
MD5 ...
,
SHA-0 and
SHA-1
In cryptography, SHA-1 (Secure Hash Algorithm 1) is a hash function which takes an input and produces a 160-bit (20-byte) hash value known as a message digest – typically rendered as 40 hexadecimal digits. It was designed by the United States ...
,
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.
During the competition, entrants were permitted to "tweak" their algorithms to address issues that were discovered. Changes that have been made to Keccak are:
* The number of
rounds was increased from to 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.
In 2014, the NIST published a draft
FIPS 202 "SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions". FIPS 202 was approved on August 5, 2015.
On August 5, 2015, NIST announced that SHA-3 had become a hashing standard.
Weakening controversy
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.
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 attack
In cryptography, a preimage attack on cryptographic hash functions tries to find a message that has a specific hash value. A cryptographic hash function should resist attacks on its preimage (set of possible inputs).
In the context of attack, the ...
s, 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 . The announced change was to accept the same ''d''/2-bit security for all forms of attack and standardize . 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.
[
In September 2013, Daniel J. Bernstein suggested on the ]NIST
The National Institute of Standards and Technology (NIST) is an agency of the United States Department of Commerce whose mission is to promote American innovation and industrial competitiveness. NIST's activities are organized into physical s ...
hash-forum mailing list 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. 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 as an option already in their SHA-3 proposal. Although the reduced capacity was justifiable in their opinion, in the light of the negative response, they proposed raising the capacity to bits for all instances. This would be as much as any previous standard up to the 256-bit security level, while providing reasonable efficiency, 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
Bruce Schneier (; born January 15, 1963) is an American cryptographer, computer security professional, privacy specialist, and writer. Schneier is an Adjunct Lecturer in Public Policy at the Harvard Kennedy School and a Fellow at the Berkman ...
criticized NIST's decision on the basis of its possible detrimental effects on the acceptance of the algorithm, saying:
He later retracted his earlier statement, saying:
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:
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.
In response to the controversy, in November 2013 John Kelsey of NIST proposed to go back to the original proposal for all SHA-2 drop-in replacement instances. The reversion was confirmed in subsequent drafts and in the final release.
Design
SHA-3 uses the sponge construction, 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
In cryptography, security level is a measure of the strength that a cryptographic primitive — such as a cipher or hash function — achieves. Security level is usually expressed as a number of " bits of security" (also security strength ...
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:
* 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 ''P''0, ..., ''P''''n''−1
* initialize the state ''S'' to a string of ''b'' zero bits
* absorb the input into the state: for each block ''P''''i'':
** extend ''P''''i'' 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 attack
In cryptography and computer security, a length extension attack is a type of attack where an attacker can use Hash(''message1'') and the length of ''message1'' to calculate Hash(''message1'' ‖ ''message2'') for an attacker-controlled ''message ...
s that SHA-2, SHA-1, MD5 and other hashes based on the Merkle–Damgård construction
In cryptography, the Merkle–Damgård construction or Merkle–Damgård hash function is a method of building collision-resistant cryptographic hash functions from collision-resistant one-way compression functions. This construction was used in t ...
are susceptible to.
In SHA-3, the state ''S'' consists of a 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 , 200 bits, to , 800 bits) can be used in practical, lightweight applications.
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
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 ) and a final 1 bit.
The maximum of zero bits occurs when the last message block is bits long. Then another block is added after the initial 1 bit, containing 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''.[ In this case, another block is added to the message, containing a 1 bit, followed by a block of 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
The block transformation ''f'', which is Keccak-f 600for 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
A word is a basic element of language that carries semantics, meaning, can be used on its own, and is uninterruptible. Despite the fact that language speakers often have an intuitive grasp of what a word is, there is no consensus among linguist ...
size, bits. The main SHA-3 submission uses 64-bit words, .
The state can be considered to be a array of bits. Let be bit of the input, using a little-endian
'' Jonathan_Swift.html" ;"title="Gulliver's Travels'' by Jonathan Swift">Gulliver's Travels'' by Jonathan Swift, the novel from which the term was coined
In computing, endianness is the order in which bytes within a word (data type), word of d ...
bit numbering convention and row-major indexing. I.e. selects the row, the column, and 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 rounds of five steps:
; (theta)
: Compute the parity of each of the (320, when ) 5-bit columns, and exclusive-or that into two nearby columns in a regular pattern. To be precise,
; (rho)
: Bitwise rotate each of the 25 words by a different triangular number
A triangular number or triangle number counts objects arranged in an equilateral triangle. Triangular numbers are a type of figurate number, other examples being square numbers and cube numbers. The th triangular number is the number of dots in ...
0, 1, 3, 6, 10, 15, .... To be precise, ''a'' 0] is not rotated, and for all , , where .
; (pi)
: Permute the 25 words in a fixed pattern. .
; (chi)
: Bitwise combine along rows, using . To be precise, . 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 , for , is XORed with bit of a degree-8 LFSR sequence. This breaks the symmetry that is preserved by the other steps.
Speed
The speed of SHA-3 hashing of long messages is dominated by the computation of ''f'' = Keccak-f 600and XORing ''S'' with the extended ''P''i, an operation on ''b'' = 1600 bits. However, since the last ''c'' bits of the extended ''P''i 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 600plus XORing 1024 bits, which roughly corresponds to SHA3-256:
*57.4 cpb on IA-32, Intel Pentium 3
*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
IA-64 (Intel Itanium architecture) is the instruction set architecture (ISA) of the discontinued Itanium family of 64-bit Intel microprocessors. The basic ISA specification originated at Hewlett-Packard (HP), and was subsequently implemented by ...
For the exact SHA3-256 on x86-64, Bernstein measures 11.7–12.25 cpb depending on the CPU. 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. 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, and also faster than SHA-2 and SHA-1.[
As of 2018, ARM's ARMv8 architecture includes special instructions which enable Keccak algorithms to execute faster and IBM's ]z/Architecture
z/Architecture, initially and briefly called ESA Modal Extensions (ESAME), is IBM's 64-bit complex instruction set computer (CISC) instruction set architecture, implemented by its mainframe computers. IBM introduced its first z/Architecture ...
includes a complete implementation of SHA-3 and SHAKE in a single instruction. There have also been extension proposals for RISC-V
RISC-V (pronounced "risk-five") is an open standard instruction set architecture (ISA) based on established reduced instruction set computer (RISC) principles. The project commenced in 2010 at the University of California, Berkeley. It transfer ...
to add Keccak-specific instructions.
Instances
The NIST standard defines the following instances, for message ''M'' and output length ''d'':[
With the following definitions
* Keccak 'c''''N'', ''d'') = sponge eccak-f[1600 pad10*1, ''r''">600.html" ;"title="eccak-f[1600">eccak-f[1600 pad10*1, ''r''''N'', ''d'')][
* Keccak-f 600= Keccak-p[1600, 24]][
* ''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.]
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:
Additional instances
In December 2016 NIST
The National Institute of Standards and Technology (NIST) is an agency of the United States Department of Commerce whose mission is to promote American innovation and industrial competitiveness. NIST's activities are organized into physical s ...
published a new document, NIST SP.800-185, describing additional SHA-3-derived functions:
• 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
KangarooTwelve
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.
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.
KangarooTwelve is a higher-performance reduced-round (from 24 to 12 rounds) version of Keccak which claims to have 128 bits of security while having performance as high as 0.55 cycles per byte on a Skylake CPU. This algorithm is an IETF
The Internet Engineering Task Force (IETF) is a standards organization for the Internet standard, Internet and is responsible for the technical standards that make up the Internet protocol suite (TCP/IP). It has no formal membership roster ...
RFC draft.
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. 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).
The Farfalle construction
In 2016, the Keccak team released a different construction called Farfalle construction, and Kravatte, an instance of Farfalle using the Keccak-p permutation, as well as two authenticated encryption algorithms Kravatte-SANE and Kravatte-SANSE
Sakura tree hashing
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.
Security against quantum attacks
There is a general result ( Grover's algorithm) that quantum computers can perform a structured preimage attack
In cryptography, a preimage attack on cryptographic hash functions tries to find a message that has a specific hash value. A cryptographic hash function should resist attacks on its preimage (set of possible inputs).
In the context of attack, the ...
in , while a classical brute-force attack needs 2''d''. A structured preimage attack implies a second preimage attack and thus a collision attack. A quantum computer can also perform a birthday attack
A birthday attack is a bruteforce collision attack that exploits the mathematics behind the birthday problem in probability theory. This attack can be used to abuse communication between two or more parties. The attack depends on the higher likeli ...
, thus break collision resistance, in (although that is disputed). Noting that the maximum strength can be , this gives the following upper bounds on the quantum security of SHA-3:
It has been shown that the Merkle–Damgård construction
In cryptography, the Merkle–Damgård construction or Merkle–Damgård hash function is a method of building collision-resistant cryptographic hash functions from collision-resistant one-way compression functions. This construction was used in t ...
, as used by SHA-2, is collapsing and, by consequence, quantum collision-resistant, 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 600 however, is efficiently invertible, and so their proof does not apply.
Examples of SHA-3 variants
The following hash values are from NIST.gov:
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
In the table below, ''internal state'' means the number of bits that are carried over to the next block.
Optimized implementation using AVX-512VL (i.e. from OpenSSL
OpenSSL is a software library for applications that provide secure communications over computer networks against eavesdropping, and identify the party at the other end. It is widely used by Internet servers, including the majority of HTTPS web ...
, running on Skylake-X CPUs) of SHA3-256 do achieve about 6.4 cycles per byte for large messages, and about 7.8 cycles per byte when using AVX2
Advanced Vector Extensions (AVX, also known as Gesher New Instructions and then Sandy Bridge New Instructions) are SIMD extensions to the x86 instruction set architecture for microprocessors from Intel and Advanced Micro Devices (AMD). They w ...
on Skylake CPUs. 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, with some older x86 CPUs up to 25–40 cycles per byte.
Implementations
Below is a list of cryptography libraries that support SHA-3:
* Rust'sbr>sha3
* Botan
* Bouncy Castle
* Crypto++
Crypto++ (also known as CryptoPP, libcrypto++, and libcryptopp) is a free and open-source C++ class library of cryptographic algorithms and schemes written by Wei Dai. Crypto++ has been widely used in academia, student projects, open-source, and ...
* Libgcrypt
* Nettle
Nettle refers to plants with stinging hairs, particularly those of the genus '' Urtica''. It can also refer to plants which resemble ''Urtica'' species in appearance but do not have stinging hairs. Plants called "nettle" include:
* ball nettle ...
* OpenSSL
OpenSSL is a software library for applications that provide secure communications over computer networks against eavesdropping, and identify the party at the other end. It is widely used by Internet servers, including the majority of HTTPS web ...
* wolfSSL
MIRACL Cryptographic SDK
* Golang'sbr>x/crypto/sha3
libkeccak
* Perl'sbr>Digest::SHA3
Hardware acceleration
Apple A13 ARMv8 six-core SoC CPU cores have support for accelerating SHA-3 (and SHA-512) using specialized instructions (EOR3, RAX1, XAR, BCAX) from ARMv8.2-SHA crypto extension set.
Some software libraries use vectorization facilities of CPUs to accelerate usage of SHA-3. For example, Crypto++ can use SSE2
SSE2 (Streaming SIMD Extensions 2) is one of the Intel SIMD (Single Instruction, Multiple Data) processor supplementary instruction sets introduced by Intel with the initial version of the Pentium 4 in 2000. SSE2 instructions allow the use of ...
on x86 for accelerating SHA3, and OpenSSL
OpenSSL is a software library for applications that provide secure communications over computer networks against eavesdropping, and identify the party at the other end. It is widely used by Internet servers, including the majority of HTTPS web ...
can use MMX, AVX-512
AVX-512 are 512-bit extensions to the 256-bit Advanced Vector Extensions SIMD instructions for x86 instruction set architecture (ISA) proposed by Intel in July 2013, and first implemented in the 2016 Intel Xeon Phi x200 (Knights Landing), and then ...
or AVX-512VL on many x86 systems too. Also POWER8
POWER8 is a family of superscalar multi-core microprocessors based on the Power ISA, announced in August 2013 at the Hot Chips conference. The designs are available for licensing under the OpenPOWER Foundation, which is the first time for suc ...
CPUs implement 2x64-bit vector rotate, defined in PowerISA 2.07, which can accelerate SHA-3 implementations. Most implementations for ARM do not use Neon
Neon is a chemical element; it has symbol Ne and atomic number 10. It is the second noble gas in the periodic table. Neon is a colorless, odorless, inert monatomic gas under standard conditions, with approximately two-thirds the density of ...
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.
The IBM z/Architecture
z/Architecture, initially and briefly called ESA Modal Extensions (ESAME), is IBM's 64-bit complex instruction set computer (CISC) instruction set architecture, implemented by its mainframe computers. IBM introduced its first z/Architecture ...
supports SHA-3 since 2017 as part of the Message-Security-Assist Extension 6.[IBM z/Architecture Principles of Operation, publication number SA22-7832. See KIMD and KLMD instructions in Chapter 7.] 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
Ethereum
Ethereum is a decentralized blockchain with smart contract functionality. Ether (abbreviation: ETH) is the native cryptocurrency of the platform. Among cryptocurrencies, ether is second only to bitcoin in market capitalization. It is open-s ...
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).
See also
* Ethash – another Keccak-based hash
References
Sources
*
External links
The Keccak web site
SHA-3 Standard
{{Cryptography navbox , hash
NIST hash function competition
Public-domain software with source code
Extendable-output functions