Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

digest: add a Readand Write wrappers #641

Open
piegamesde opened this issue May 7, 2021 · 1 comment
Open

digest: add a Readand Write wrappers #641

piegamesde opened this issue May 7, 2021 · 1 comment
Labels
digest Hash function crate

Comments

@piegamesde
Copy link

I can pass a hasher where I need a Write, and I'll get the digest of the written bytes. I can also have a reader and std::io::copy into the hasher to get the digest of all read bytes. In both cases, those bytes go into the void, there is nothing of them left except for the hash.

Sometimes, I want to process data and hash it along the way. So it'd be cool to have Read and Write wrappers for hashers that can decorate around any IO and give me the hash while passing the data along.

@newpavlov newpavlov transferred this issue from RustCrypto/hashes May 26, 2021
@newpavlov newpavlov changed the title Add a Write wrapper digest: add a Readand Write wrappers May 26, 2021
@newpavlov newpavlov added the digest Hash function crate label May 26, 2021
@piegamesde
Copy link
Author

I've found https://stackoverflow.com/questions/60336419/how-can-i-pipe-bytes-from-a-reader-to-a-writer-with-an-interceptor which has more or less the same problem. The workaround answer suggests to use a Write fanout like provided by the broadcast crate.

Nevertheless, a direct solution to the problem would be appreciated. I'd be willing to help implement, given some guidance on how an acceptable solution would look like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
digest Hash function crate
Projects
None yet
Development

No branches or pull requests

2 participants