Cryptographic Hash Functions
Table of Contents
Introduction
Cryptographic hashing functions.
Module Contents
Functions
Computes the keccak256 hash of the input buffer. |
|
Computes the keccak512 hash of the input buffer. |
Attributes
Module Details
Hash32
- Hash32
Hash32 = Bytes32
Hash64
- Hash64
Hash64 = Bytes64
keccak256
- keccak256(buffer: ethereum.base_types.Bytes) → Hash32
Computes the keccak256 hash of the input buffer.
- Parameters
buffer – Input for the hashing function.
- Returns
hash – Output of the hash function.
- Return type
ethereum.base_types.Hash32
def keccak256(buffer: Bytes) -> Hash32:
k = keccak.new(digest_bits=256)
return Hash32(k.update(buffer).digest())
keccak512
- keccak512(buffer: ethereum.base_types.Bytes) → Hash64
Computes the keccak512 hash of the input buffer.
- Parameters
buffer – Input for the hashing function.
- Returns
hash – Output of the hash function.
- Return type
ethereum.base_types.Hash32
def keccak512(buffer: Bytes) -> Hash64:
k = keccak.new(digest_bits=512)
return Hash64(k.update(buffer).digest())