Library hex

To use this library in your code:

import encoding.hex

Functions

Takes an input string consisting only of valid hexadecimal digits and returns the corresponding bytes in big-endian order.
Example

  hex.decode "f00d"   // Evaluates to #[0xf0, 0x0d].
  hex.decode "7CAFE"  // Evaluates to #[0x07, 0xca, 0xfe].

Takes an input data and returns the corresponding string of hex digits.
Examples

  hex.encode #[0x12, 0x34]  // Evaluates to the string "1234".
  hex.encode #[0x00, 0x42]  // Evaluates to the string "0042".
  hex.encode "A*"           // Evaluates to the string "412a".
  hex.encode #[]            // Evaluates to the empty string "".