Expand description
BLAKE3 Merkle tree construction, adaptive chunk sizing, and directory hashing. BLAKE3 hashing, Merkle tree, delta detection, directory hashing.
Structs§
- Chunk
Hash - Per-chunk hash with file offset metadata.
- DirHash
Accumulator - Accumulates S3 restore child entries per directory prefix, producing a
dir hash when
finalize()is called for a given prefix. - Dirty
Range - A contiguous byte range that differs between source and target.
- Merkle
Signature - Serializable Merkle signature for xattr/sidecar storage.
- Merkle
Tree - BLAKE3 Merkle tree over fixed-size file chunks.
Enums§
- Checksum
Type - Checksum algorithm selection for sidecar file generation. BLAKE3 is FREE (reuses existing computation). Others require extra I/O.
- Compute
Mode - Controls which per-chunk computations
MerkleTree::from_file()performs.
Constants§
- CHUNK_
SIZE - Keep backward compat for callers using CHUNK_SIZE directly
- MAX_
LEAVES_ PER_ XATTR - Max Merkle leaves per xattr – defined in constants.rs for central tuning.
- MIN_
CHUNK_ SIZE - Minimum chunk size for Merkle tree – defined in constants.rs for central tuning.
Functions§
- calculate_
adaptive_ chunk_ size - Calculate chunk size for Merkle tree construction.
- compute_
dir_ hash - Compute a directory hash from sorted child (name, hash) pairs.
Uses BLAKE3 over concatenation of sorted
name:hashentries. Provides a stable, order-independent directory fingerprint. - compute_
dir_ hash_ from_ path - Compute a directory hash by reading the directory at
path. Each child’s metadata (size, mtime, type) is hashed, then all children are sorted by name and combined into a single BLAKE3 directory fingerprint. Skips foxing internal files (.foxing*, .foxing_meta sidecars). - compute_
dir_ hash_ from_ s3_ children - Compute a directory hash from S3 child metadata.
- get_
lite_ threshold_ bytes - Get the current lite hash threshold in bytes
- hash_
buffer_ full - Full BLAKE3 hash from an in-memory buffer (same algorithm as
hash_file_full). - hash_
buffer_ lite - Lite hash from an in-memory buffer (head+tail sampling, same algorithm as
hash_file_lite). - hash_
file_ checksum - Compute a hex-encoded checksum of a file using the specified algorithm.
- hash_
file_ full - Compute a full BLAKE3 hash of an entire file.
- hash_
file_ lite - Compute a fast BLAKE3 hash from the first and last 64KB of a file (head+tail sampling)
- is_
hashing_ enabled - Check whether BLAKE3 hashing is currently enabled
- log_
crypto_ capabilities - Log detected cryptographic hardware acceleration at startup. Called once during initialization to inform operators which hash algorithms benefit from hardware acceleration on this platform.
- map_
data_ extents - Map allocated data extents in a file using SEEK_DATA/SEEK_HOLE. Returns Vec of (offset, length) pairs for data regions. Returns Err if the filesystem doesn’t support SEEK_HOLE.
- set_
hashing_ enabled - Enable or disable BLAKE3 hashing globally
- set_
lite_ threshold_ kb - Set the minimum file size (in KB) for lite hash computation
- shannon_
entropy - Compute Shannon entropy of a byte slice, returning bits per symbol (0.0-8.0).
- verify_
incremental - Verify that src and dst have matching lite hashes (returns true if identical or below threshold)
- verify_
with_ merkle - Compare a source file’s Merkle root against a stored signature.
- write_
checksum_ files - Write checksum sidecar files next to a destination file.
Format: GNU coreutils-compatible
<hash> <filename>\nWhencid_formatis true and checksum type is BLAKE3, outputs CID base32lower instead of hex.