Skip to main content

Module hash

Module hash 

Source
Expand description

BLAKE3 hashing helpers.

A Hash is a fixed 32-byte digest. The canonical hex form is 64 lowercase characters. Object-store paths split the digest into a first-byte directory and 62-char file-name (see SPEC-OBJECTS.md §10).

Structs§

Hasher
Incremental BLAKE3 hasher for streaming data.
ObjectPath
Object-store path split: <first-byte-hex>/<remaining-62-hex>.

Enums§

FromHexError
Errors returned by from_hex.

Constants§

HASH_LEN
Length, in bytes, of a BLAKE3 digest used throughout mkit.
HEX_LEN
Length of the lowercase-hex encoding of a Hash.
ZERO
The all-zero digest. Used as the “absent” sentinel for optional annotation fields on commit objects (message_hash, content_digest).

Functions§

domain_digest
Domain-separated BLAKE3 digest.
from_hex
Parse a lowercase-or-uppercase 64-char hex string into a Hash. Rejects any non-hex byte.
hash
Hash arbitrary bytes in one shot.
object_path
Split a Hash into its object-store path components.
to_hex
Render a Hash as lowercase hex.
to_hex_bytes
Render a byte slice as lowercase hex. format!-with-{:02x} allocates per byte; the hand-roll here is the workspace’s canonical hex encoder. Use this everywhere a byte slice needs hex rendering.

Type Aliases§

Hash
Fixed-size BLAKE3 digest. Copy because it is tiny and cheap.