In the original Keccak you would pad by adding a 1 bit proceeded by a predetermined amount of 0 bits and then another 1 bit.

When Keccak was standardized to sha3 the padding was changed. It was then (unless you needed to pad by just one character) 0x06, followed by a predetermined number of 0 bytes and then 0x80.

My question is... why was this change made?


1 Answer 1


It accomplishes 2 things.

  1. SHA-3 hashes of the same input will be distinct from Keccak hashes with the same rate/capacity.

  2. XOFs (SHAKE) with the same rate/capacity will start also with distinct hash output, when compared to both SHA-3 and Keccak

There is no change to security or performance, although having SHAKE share a prefix with a hash of the same input would have been considered a security concern.

Also, padding conventions differ between the implementation and the code, the difference between SHA-3 padding and Keccak padding is minimal. SHA-3 still supports inputs in bits rather than bytes, and the padding is also bit based.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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