decode_hex_32

Function decode_hex_32 

Source
pub fn decode_hex_32(hex: &[u8; 64]) -> Option<[u8; 32]>
Expand description

Decode a 64-hex-character string into a 32-byte array.

The input must be exactly 64 hexadecimal ASCII bytes (lower- or upper-case). Returns None if any character is not a valid hex digit.

Example:

let hex = *b"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
let bytes = decode_hex_32(&hex).unwrap();
assert_eq!(bytes.len(), 32);