pub fn hash_file_raw(algo: HashAlgorithm, path: &Path) -> Result<String>Expand description
Hash a single file using raw Linux syscalls for minimum overhead. Bypasses Rust’s File abstraction entirely: raw open/fstat/read/close. For the single-file fast path, this eliminates OpenOptions builder, CString heap allocation, File wrapper overhead, and Read trait dispatch.
Size-based dispatch:
- Tiny (<8KB): stack buffer + raw read + hash_bytes (3 syscalls total)
- Small (8KB-16MB): wraps fd in File, reads into thread-local buffer
- Large (>=16MB): wraps fd in File, mmaps with HugePage + PopulateRead
- Non-regular: wraps fd in File, streaming hash_reader