File Section Hasher
A Rust library to compute a 64-bit unsigned integer (u64) hash for a specific section of a file. Implements the Write trait for incremental hashing.
The hash algorithm is std::hash::DefaultHasher.
Overview
Use FileHasher::new() to create an instance. Write data into it, and each write operation updates the hash value. Once all data is written, the final u64 hash is generated.
Key features:
- Hash a specific portion of a file (e.g., skip header/footer).
- Incremental hashing via the
Writetrait.
Examples
Example: Hashing a File Section
use File;
use ;
use FileHasher;
Example: using Write Trait
use ;
use FileHasher;
let mut hasher = new;
hasher.write_all?;
hasher.write_all?;
let hash = hasher.finish; // Get the hash after all writes
Main Function: hash()
reader: A readable and seekable input source (e.g., file).from_byte: Starting byte offset (0-based).length: Number of bytes to hash.- Returns: Computed u64 hash or an I/O error.