/// Finalizes and returns the computed MD5 hash.
Finalizes and returns the computed MD5 hash.
Finalizes and returns the computed MD5 hash .
pub fn md5(&self) -> [u8; 16] {
        // Finalize locally.
        let mut block = [0; Md5::BLOCK_LEN];
        let mut state = self.state;
        // The block length is the amount of data buffered for the current block.
        let block_len = (self.len & Md5::BLOCK_LEN_MASK) as usize;
        // The block length should *always* be less than the MD5 block length if the process_*
        // functions transform the block when it's full.
        assert!(block_len < Md5::BLOCK_LEN);
        // Copy the buffered block data locally for finalization.
        block[..block_len].copy_from_slice(&self.block[..block_len]);
        // Append the message terminator to the block.
        block[block_len] = 0x80;
        // If the message length can not be appended to the block, transform the block, and start
        // a new block.
        if Md5::BLOCK_LEN - block_len - 1 < 8 {
            transform(&mut state, &block);
            block = [0; Md5::BLOCK_LEN];
        }
        // The final 8 bytes of the final block contain the message length in bits mod 2^64.
        block[Md5::BLOCK_LEN - 8..Md5::BLOCK_LEN].copy_from_slice(&(self.len << 3).to_le_bytes());
        transform(&mut state, &block);
        // The message digest is in big-endian.
        let mut hash = [0; 16];
        hash[0..4].copy_from_slice(&state[0].to_le_bytes());
        hash[4..8].copy_from_slice(&state[1].to_le_bytes());
        hash[8..12].copy_from_slice(&state[2].to_le_bytes());
        hash[12..16].copy_from_slice(&state[3].to_le_bytes());
        hash
    }
pub fn md5 ( & self ) -> [ u8 ; 16 ] { // Finalize locally. let mut block = [ 0 ; Md5 :: BLOCK_LEN ] ; let mut state = self . state ; // The block length is the amount of data buffered for the current block. let block_len = ( self . len & Md5 :: BLOCK_LEN_MASK ) as usize ; // The block length should *always* be less than the MD5 block length if the process_* // functions transform the block when it's full. assert ! ( block_len Md5 BLOCK_LEN ) ; // Copy the buffered block data locally for finalization. block [ .. block_len ] . copy_from_slice ( & self . block [ .. block_len ] ) ; // Append the message terminator to the block. block [ block_len ] = 0x80 ; // If the message length can not be appended to the block, transform the block, and start // a new block. if Md5 :: BLOCK_LEN - block_len - 1 < 8 { transform ( & mut state , & block ) ; block = [ 0 ; Md5 :: BLOCK_LEN ] ; } // The final 8 bytes of the final block contain the message length in bits mod 2^64. block [ Md5 :: BLOCK_LEN - 8 .. Md5 :: BLOCK_LEN ] . copy_from_slice ( & ( self . len << 3 ) . to_le_bytes ( ) ) ; transform ( & mut state , & block ) ; // The message digest is in big-endian. let mut hash = [ 0 ; 16 ] ; hash [ 0 .. 4 ] . copy_from_slice ( & state [ 0 ] . to_le_bytes ( ) ) ; hash [ 4 .. 8 ] . copy_from_slice ( & state [ 1 ] . to_le_bytes ( ) ) ; hash [ 8 .. 12 ] . copy_from_slice ( & state [ 2 ] . to_le_bytes ( ) ) ; hash [ 12 .. 16 ] . copy_from_slice ( & state [ 3 ] . to_le_bytes ( ) ) ; hash }
Finalizes and returns the computed MD5 hash.
Finalizes and returns the computed MD5 hash .
&self