Crates.io | b2sum-rust |
lib.rs | b2sum-rust |
version | 0.3.0 |
source | src |
created_at | 2019-11-15 19:34:11.444102 |
updated_at | 2021-03-08 19:55:32.495627 |
description | A Rust Library For Computing The Blake2b Hash of Files with any given Digest Size |
homepage | |
repository | https://github.com/0xAtropine/b2sum-rust |
max_upload_size | |
id | 181613 |
size | 15,155 |
A Pure Rust Library For Hashing Files using Blake2b with any given digest size.
It takes advantage of the crates filebuffer and Blake2-rfc, with filebuffer providing more speed than the std::io
primitive.
Make sure to add b2sum-rust
to your cargo.toml
use b2sum_rust::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);
}
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-rust
.
MIT
Apache-2.0