BLAKE3
BLAKE3 digest algorithms.
Keyword-only options: digest_size (any positive length; BLAKE3 is extendable, so shorter outputs are prefixes of longer ones), key (32 bytes, keyed hashing) or derive_key_context (a hardcoded, globally unique context string for key derivation). key and derive_key_context are mutually exclusive.
Example
from oxcrypto.hash.blake3 import BLAKE3
algorithm = BLAKE3.BLAKE3
digest = algorithm.digest(b"hello")
assert digest == algorithm.digest_chunks([b"he", b"llo"])
hasher = algorithm.new()
hasher.update(b"he")
hasher.update(b"llo")
assert hasher.digest() == digest
print(digest.hex())Variants
BLAKE3.BLAKE3
Methods
digest(self, data: bytes, /, *, digest_size: int | None=None, key: bytes | None=None, derive_key_context: str | None=None) -> bytes
digest_chunks(self, chunks: Iterable[bytes], /, *, digest_size: int | None=None, key: bytes | None=None, derive_key_context: str | None=None) -> bytes
new(self, *, digest_size: int | None=None, key: bytes | None=None, derive_key_context: str | None=None) -> Hasher