#hash #write #hasher #clone

fileparthasher

File hasher to calculate the hash for a section of a file, the hash is u64 size. The Write trait was implemented for it.

2 releases

Uses new Rust 2024

new 0.0.2 May 15, 2025
0.0.1 May 14, 2025

#28 in #hasher

44 downloads per month
Used in 2 crates

Custom license

49KB
1K SLoC

File hasher

File hasher to calculate the hash for a section of a file, the hash is u64 size. The Write trait was implemented for it.

Overview

The file hasher uses the DefaultHasher to hash a file.

#[derive(Debug, Clone)]
pub struct FileHasher {
    hasher: DefaultHasher,
}

It can hash part of a file, its hash function protocol is this: pub fn hash<R>(&mut self, reader: &mut R, from_byte: u64, length: u64) -> Result<u64, Error> where R: Read + Seek;

Dependencies

~0–17MB
~277K SLoC