ethereum.crypto.hash
Cryptographic Hash Functions.
.. contents:: Table of Contents :backlinks: none :local:
Introduction
Cryptographic hashing functions.
Hash32¶
| 19 | Hash32 = Bytes32 |
|---|
Hash64¶
| 20 | Hash64 = Bytes64 |
|---|
_hashlib_has_keccak ¶
Return True if hashlib can compute pre-NIST Keccak digests.
_USE_HASHLIB¶
| 39 | _USE_HASHLIB = _hashlib_has_keccak() |
|---|
def _keccak256_digest(buffer: bytes | bytearray) -> bytes:
| 45 | return hashlib.new("keccak-256", buffer).digest() |
|---|
def _keccak512_digest(buffer: bytes | bytearray) -> bytes:
| 48 | return hashlib.new("keccak-512", buffer).digest() |
|---|
keccak256 ¶
Computes the keccak256 hash of the input buffer.
Parameters
buffer : Input for the hashing function.
Returns
hash : ethereum.base_types.Hash32
Output of the hash function.
keccak512 ¶
Computes the keccak512 hash of the input buffer.
Parameters
buffer : Input for the hashing function.
Returns
hash : ethereum.base_types.Hash32
Output of the hash function.