Skip to content

uttarayan21/write-hasher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WriteHasher

Hash the data being written to a writer.
Supports tokio::io::AsyncWrite, futures::io::AsyncWrite, std::io::Write.

Example

extern crate sha2;
use sha2::Sha256;
use write_hasher::WriteHasher;

let mut file = std::fs::File::open("Cargo.toml").unwrap();
let dest = std::io::sink();
let dest = WriteHasher::<Sha256, _>::new(dest);
std::io::copy(&mut file, &mut dest).unwrap();
let hash = dest.finalize();

You can use async functions as well as std functions for this as well.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published