normalized-hash 0.1.0

Cross-platform hash algorithm.
Documentation
  • Coverage
  • 85.71%
    6 out of 7 items documented5 out of 7 items with examples
  • Size
  • Source code size: 22.48 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.57 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 17s Average build duration of successful builds.
  • all releases: 17s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • FloGa/normalized-hasher
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • FloGa

normalized-hash

badge github badge crates.io badge docs.rs badge license

Cross-platform hash algorithm.

This is the library crate. If you're looking for the binary crate instead, go to normalized-hasher.

Summary

This hashing algorithm allows consistent hashes even if you accidentally convert a file from using UNIX line endings (LF) to Windows line endings (CRLF). For a longish motivational speech about how such a thing can happen and why you should want to even care about such a case, head over to normalized-hasher.

Code Example

use std::path::PathBuf;

use normalized_hash::Hasher;

fn main() {
    let file_in = PathBuf::from("input.txt");
    let file_out = PathBuf::from("output.txt");

    // Simple example with default options, without writing an output file
    let hash = Hasher::new().hash_file(&file_in, None::<PathBuf>);
    println!("{}", hash);

    // More complex example, with writing output
    let hash = Hasher::new()
        .eol("\r\n")
        .no_eof(true)
        .hash_file(&file_in, Some(file_out));
    println!("{}", hash);
}