Keccak and sha-3 are not the same. In 2007, U.S. National Institute of Standard and Technology (NIST) initiated a competition about SHA-3. In 2012, Keccak team won the competition. From then on, developers implemented lots of “sha3” solution based on Keccak. However, in 2014, NIST modified Keccak solution and released FIPS 202, and this updated proposal becomes official SHA-3 standard on Aug 2015. Many “old” program still use Keccak, and do
not upgrade to official SHA-3 standard.
“old” code based on Keccak does not generate the same hash value as SHA-3 does. So, if using a “sha3” library, you should be crystal clear that the library is based on Keccak or based on standard SHA-3. A simple solution is
doing a test for empty input:
SHA-3 standard output is:
a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a
Many old Keccak-256 outputs are:
c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470
The key idea
behind SHA-3 is based on unkeyed permutations, as opposed to other typical hash function
constructions that used keyed permutations. Keccak also does not make use of the Merkle-
Damgard transformation that is commonly used to handle arbitrary-length input messages in
hash functions. A newer approach, called sponge and squeeze construction, is used in Keccak.
It is a random permutation model. Different variants of SHA-3 have been standardized, such
as SHA3-224, SHA3-256, SHA3-384, SHA3-512, SHAKE128, and SHAKE256
If you ever used this:
web3.utils.soliditySha3()
eben though name is Sha3 but its actually implemented by keccak256