Crate hex

source ·
Expand description

Encoding and decoding hex strings.

For most cases, you can simply use the decode(), encode() and encode_upper() functions. If you need a bit more control, use the traits ToHex and FromHex instead.

§Example

extern crate hex;

fn main() {
    let hex_string = hex::encode("Hello world!");
    println!("{}", hex_string); // Prints '48656c6c6f20776f726c6421'
}

Enums§

  • The error type for decoding a hex string into Vec<u8> or [u8; N].

Traits§

  • Types that can be decoded from a hex string.
  • Encoding values as hex string.

Functions§

  • Decodes a hex string into raw bytes.
  • Encodes data as hex string using lowercase characters.
  • Encodes data as hex string using uppercase characters.