Skip to main content

str_to_bytes32

Function str_to_bytes32 

Source
pub fn str_to_bytes32(s: &str) -> [u8; 32]
Expand description

Convert a string slice to a [u8; 32] Pads zeros to the left of significant bytes in the [u8; 32] slice. i.e. 0xa57b becomes [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 165, 123]