pub fn decode(input: &[u8]) -> Result<Vec<u8>, HexError>Available on crate feature
alloc only.Expand description
Constant-Time Hex Decoding
§Arguments
input- The hex-encoded slice to decode.
§Errors
HexError::Size: Theinputlength was not an even number.HexError::Encoding: An invalid character was encountered.
§Returns
The decoded bytes.
§Example
use wolf_crypto::{hex, ct_eq};
let encoded = hex::encode(b"hello world");
let decoded = hex::decode(encoded.as_bytes()).unwrap();
assert!(ct_eq(b"hello world", decoded));