Skip to main content

to_hex

Function to_hex 

Source
pub fn to_hex([a, b, c, d]: [u32; 4]) -> [u8; 32]
Expand description

Convert an MD5 hash to ASCII hex.

Implemented using bitwise operations on each u32 to spread each nibble into separate bytes, followed by adding either ‘0’ or ‘a’ to each byte using a bitmask.

§Examples

assert_eq!(
    to_hex([0xd41d8cd9, 0x8f00b204, 0xe9800998, 0xecf8427e]),
    *b"d41d8cd98f00b204e9800998ecf8427e",
);