Skip to main content

Fingerprint

Trait Fingerprint 

Source
pub trait Fingerprint {
    // Required method
    fn fingerprint(&self) -> Result<Fp>;
}
Expand description

Computes a content-based fingerprint for a file.

Implemented on Path to hash the full file contents using BLAKE3, producing a stable 32-byte digest that is independent of filesystem metadata such as modification time or file size.

§Hashing strategy

The implementation selects between two BLAKE3 strategies based on file size:

  • < 10 MiBupdate_reader: plain buffered sequential read. Avoids mmap syscall overhead for small files. On slow storage, a single sequential read() into a buffer is faster than taking page faults through a memory mapping. The typical e-book (100 KiB–500 KiB) falls into this range.

  • ≥ 10 MiBupdate_mmap: single-threaded memory-mapped hashing. Avoids buffered-read overhead for large files while keeping CPU usage on a single core.

Required Methods§

Implementations on Foreign Types§

Source§

impl Fingerprint for Path

Implementors§