talira

Hexadecimal encoding and decoding for Rust

open sourceMIT OR Apache-2.0free

hex is a small Rust crate for encoding data into hexadecimal strings and decoding hex back into bytes, originally extracted from rustc-serialize. It works in no_std environments by turning off its default std and alloc features, and an optional serde feature serializes and deserializes values as hex.

Problems it solves

  • convert bytes to a hex string in Rust
  • decode a hexadecimal string into bytes in a Rust program
  • hex-encode data in a no_std embedded Rust project

Features

  • encode bytes and strings to hex
  • decode hex strings to bytes
  • no_std support with optional alloc
  • optional serde support

Limitations

  • Requires Rust 1.85 or newer1

Alternatives

The same job

These do what hex does.

  1. base64 Base64 encoding and decoding for Rust

Compare hex with the top 3