For example, this Python file implements SHA3 in a compact and very readable form in Python. I wonder if we have those compact implementations for the primitives used on Ethereum, in special Keccak (not SHA3) and ECDSA (signing and recover).
1 Answer
For Keccak the delimitedSuffix
should be 0x01
instead of 0x06
in SHA3.
So it should look like
def Keccak_256(inputBytes):
return Keccak(1088, 512, inputBytes, 0x01, 256//8)