1 unstable release

0.1.0 Oct 26, 2020

#1289 in Cryptography

GPL-3.0-only

450KB
802 lines

Overview

inc-sha1 is a library for incrementally calculating an SHA-1 hash value. It uses the sha crate but encapsulates handling of partial blocks and final padding so that the application can simply write any number of blocks of bytes of any length and ask for a final hash value.


lib.rs:

Incremental SHA1 Calculator

Inc-SHA1 is a library for incrementally calculating an SHA-1 hash value. It uses the sha crate but encapsulates handling of partial blocks and final padding so that the application can simply write any number of blocks of bytes of any length and ask for a final hash value.

Example

let mut hasher = inc_sha1::Hasher::new();
hasher.write(b"Hello ");
hasher.write(b"World!");
let hash = hasher.finish();
let hex_hash = hex::encode(hash);
assert_eq!(hex_hash, "2ef7bde608ce5404e97d5f042f95f89f1c232871");

Dependencies