pub fn reader_digest<R: Read>(&self, reader: &mut R) -> Result<String, io::Error> {
        let mut buffer = [0; 512000];
        let mut hasher = match self {
            HashAlgorithm::Sha1 => crypto_hash::Hasher::new(crypto_hash::Algorithm::SHA1),
            HashAlgorithm::Sha256 => crypto_hash::Hasher::new(crypto_hash::Algorithm::SHA256),
            HashAlgorithm::Sha512 => crypto_hash::Hasher::new(crypto_hash::Algorithm::SHA512),
        };
        loop {
            let n_bytes = reader.read(&mut buffer)?;
            if n_bytes == 0 {
                break;
            };
            hasher.write_all(&buffer[..n_bytes])?;
        }
        let mut s = String::new();
        hasher
            .finish()
            .write_hex_upper(&mut s)
            .expect("HEX format failed");
        Ok(s)
    }
/// Returns the hash digest for `reader`'s as a hexadecimal string.crypto_hash.
Returns the hash digest for `reader`'s as a hexadecimal string.crypto_hash.
Returns the hash digest for ` reader ` ' s as a hexadecimal string . crypto_hash .
pub fn reader_digest<R: Read>(&self, reader: &mut R) -> Result<String, io::Error> {
        let mut buffer = [0; 512000];
        let mut hasher = match self {
            HashAlgorithm::Sha1 => crypto_hash::Hasher::new(crypto_hash::Algorithm::SHA1),
            HashAlgorithm::Sha256 => crypto_hash::Hasher::new(crypto_hash::Algorithm::SHA256),
            HashAlgorithm::Sha512 => crypto_hash::Hasher::new(crypto_hash::Algorithm::SHA512),
        };
        loop {
            let n_bytes = reader.read(&mut buffer)?;
            if n_bytes == 0 {
                break;
            };
            hasher.write_all(&buffer[..n_bytes])?;
        }
        let mut s = String::new();
        hasher
            .finish()
            .write_hex_upper(&mut s)
            .expect("HEX format failed");
        Ok(s)
    }
pub fn reader_digest < R : Read > ( & self , reader : & mut R ) -> Result < String , io :: Error > { let mut buffer = [ 0 ; 512000 ] ; let mut hasher = match self { HashAlgorithm :: Sha1 => crypto_hash :: Hasher :: new ( crypto_hash :: Algorithm :: SHA1 ) , HashAlgorithm :: Sha256 => crypto_hash :: Hasher :: new ( crypto_hash :: Algorithm :: SHA256 ) , HashAlgorithm :: Sha512 => crypto_hash :: Hasher :: new ( crypto_hash :: Algorithm :: SHA512 ) , } ; loop { let n_bytes = reader . read ( & mut buffer ) ? ; if n_bytes == 0 { break ; } ; hasher . write_all ( & buffer [ .. n_bytes ] ) ? ; } let mut s = String :: new ( ) ; hasher . finish ( ) . write_hex_upper ( & mut s ) . expect ( " " ) ; Ok ( s ) }
Returns the hash digest for `reader`'s as a hexadecimal string.crypto_hash.
Returns the hash digest for ` reader ` ' s as a hexadecimal string . crypto_hash .
&self
reader
&mut R