I have been reviewing keccak256 implementation and sha3-256 that follows the FIPS standard. The sponge function is taking a while to set in, but I have noticed a difference in implementation :

I noticed web3.js uses crypto-js implementation of sha3: https://github.com/brix/crypto-js/blob/develop/src/sha3.js From that I gather the var LFSR = 0x01;

which is set to 0x06 in sha3-256. Am I correct in this observation?

What other differences are there?

  • I have confirmed with test cases that this is the fundamental difference in the 2 algorithms. I have also tested with Solidity. – user2163865 Nov 10 '17 at 9:49

from an answer to What are the key differences between the draft SHA-3 standard and the Keccak submission?:

  1. No they did not, the internals and security levels have not been changed from the draft Keccak submission, only the padding rule has changed.
  2. The padding change is the only difference, this allows future tree hashing modes as well as the current SHAKE outputs to generate different digests given the same security parameters and message inputs. Up to 4 additional bits are added, which keeps the full padding inside a byte boundary, making implementations with octet only input able to switch to SHA-3 from Keccak with change to only a single line of code.
  3. The padding change has no negative impact on the security of SHA-3.

There is good explanation here: https://www.cybertest.com/blog/keccak-vs-sha3

  • 1
    It is recommend to include the main ideas in the answer and only use the link as reference since links can become stales. – Ismael Feb 26 at 2:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.