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 1


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)

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.