Hash a file by path. Single open + fstat to minimize syscalls.
Uses zero-copy mmap for regular files: the hash function reads directly
from the page cache without any kernel→user memcpy or read() syscalls.
MAP_POPULATE prefaults all pages before hashing starts.
MADV_HUGEPAGE uses 2MB pages to reduce TLB misses by ~500x.
Parse a BSD-style tag line: “ALGO (filename) = hash”
Returns (expected_hash, filename, optional_bits).
bits is the hash length parsed from the algo name (e.g., BLAKE2b-256 -> Some(256)).
Check if parallel hashing is worthwhile for the given file paths.
Always parallelizes with 2+ files — rayon’s thread pool is already initialized
and work-stealing overhead is minimal (~1µs per file dispatch).
With mmap, each thread independently maps and hashes its own file with no
shared state, giving near-linear speedup with available cores.