Constant data_encoding::HEXLOWER_PERMISSIVE
source · pub const HEXLOWER_PERMISSIVE: Encoding;
Expand description
Lowercase hexadecimal encoding with case-insensitive decoding
This encoding is a static version of:
let mut spec = Specification::new();
spec.symbols.push_str("0123456789abcdef");
spec.translate.from.push_str("ABCDEF");
spec.translate.to.push_str("abcdef");
assert_eq!(HEXLOWER_PERMISSIVE, spec.encoding().unwrap());
Examples
use data_encoding::HEXLOWER_PERMISSIVE;
let deadbeef = vec![0xde, 0xad, 0xbe, 0xef];
assert_eq!(HEXLOWER_PERMISSIVE.decode(b"DeadBeef").unwrap(), deadbeef);
assert_eq!(HEXLOWER_PERMISSIVE.encode(&deadbeef), "deadbeef");
You can also define a shorter name:
use data_encoding::{Encoding, HEXLOWER_PERMISSIVE};
const HEX: Encoding = HEXLOWER_PERMISSIVE;