salvus.flow.acta.hashing
salvus.flow.acta.hashing salvus flow acta hashing BLAKE3 hashing for content, cache keys, and file identities.
Functions
content_digest()
content_digest()def content_digest(data: bytes) -> str: ...Return the hex digest of some bytes.
Parameters
databytes — The bytes to hash.
Returns str — The 64-character lowercase hex digest.
hash_file()
hash_file()def hash_file(path: pathlib.Path | str, chunk_size: int = 1048576) -> str: ...Return the hex digest of a file’s contents.
Use memory mapping when available, otherwise read in blocks.
Parameters
pathpathlib.Path | str — The file to hash.chunk_sizeint =1048576— Bytes to read per iteration, if the fallback is used. Ignored on the mapped path, which does not chunk.
Returns str — The 64-character lowercase hex digest of the file’s bytes.
new_hasher()
new_hasher()def new_hasher(threaded: bool = False) -> blake3: ...Return a fresh incremental hasher.
Parameters
threadedbool =False— Whether to hash across all cores. The digest is the same either way; only the speed differs.
Returns blake3 — A hasher with
update and hexdigest.