Skip to content

Conversation

@bozaro
Copy link

@bozaro bozaro commented Jun 22, 2016

No description provided.

@bozaro
Copy link
Author

bozaro commented Jun 22, 2016

@apoelstra
I think, this change is better then #294 because this change affects all digests (SHA1, SHA256, MD5, HMAC etc).

@bozaro
Copy link
Author

bozaro commented Jun 22, 2016

Usage example:

use crypto::digest::Digest;
use crypto::md5::Md5;
use std::io;
use std::io::{Error, Read, Write};

pub fn stream_md5<R: Read>(reader: &mut R) -> Result<String, Error> {
    let mut hash = Md5::new();
    try! (io::copy(reader, &mut hash.as_write()));
    Ok(hash.result_str())
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant