2 releases
0.1.1 | Aug 17, 2021 |
---|---|
0.1.0 | Aug 17, 2021 |
#2503 in Cryptography
10KB
62 lines
b2sum
A Pure Rust Library For Hashing Files using Blake2b with any given digest size and includes hashing with a key.
It takes advantage of the crates filebuffer and Blake2-rfc, with filebuffer providing more speed than the std::io
primitive.
Example
Make sure to add b2sum-rs
to your cargo.toml
use b2sum_rs::Blake2bSum;
fn main(){
// Creates a new File Instance with a digest size of 64 bytes
let context = Blake2bSum::new(64);
// Outputs a Hexadecimal String
let hash = context.read("example_file.txt");
// Converts the hexadecimal string to a vector of bytes
let _bytes = Blake2bSum::as_bytes(&hash);
// Prints The Hexadecimal Representation
println!("Hash: {}",hash);
}
Note
This crates name is not b2sum
. That crate is a command-line hashing tool. This crate is a library that provides API for implementing hashing of files into other projects. This crates name is b2sum-rs
.
License
-
MIT
-
Apache-2.0
Dependencies
~185–400KB