std::encoding::hexHexadecimal encoding and decoding.
Encode binary data to hexadecimal strings (lowercase or uppercase) and decode hexadecimal strings back to binary data.
import std::encoding::hex;
fn main() {
let data: bytes = bytes::new();
data.push(0xDE);
data.push(0xAD);
let s = hex.encode(data);
println(s); // "dead"
let back = hex.decode(s);
println(back.len()); // 2
}
encodeEncode binary data to a lowercase hex string.
encode_upperEncode binary data to an uppercase hex string.
decodeDecode a hex string to binary data.
Returns an empty bytes buffer if the input is not valid hex.