$ const-hex

v1.18.0MAJOR UPDATE

Fast byte array to hex string conversion

Downloads: 26.9M
Recent: 5.2M
Versions: 31
Updated: February 25, 2026

Latest Update Summary

Crate

Name: const-hex New version: 1.18.0 Release date: 2026-02-25T08:56:06.345588Z

Crate readme

Short description This crate provides a fast conversion of byte arrays to hexadecimal strings, both at compile time, and at run time.

Long description It aims to be a drop-in replacement for the hex crate, and extends the API with const-eval, a const-generics formatting buffer, and more. This crate offers performance comparable to faster-hex on x86/x86-64 but outperforms it on other platforms, and is significantly faster than hex in encoding and decoding.

Features • Drop-in replacement for hexconst-eval support • const-generics formatting buffer • Performance outperforming faster-hex on non-x86 architectures • Designed for rustc 1.64+

Code Examples Basic usage

 use const_hex::const_encode;

let hex = const_encode!(b"hello");

Add to Cargo.toml

 [dependencies]
const-hex = "<version>"

Linkshttps://crates.io/crates/const-hexhttps://docs.rs/const-hexhttps://github.com/danipopes/const-hex

https://docs.rs/const-hex

Release info

Release version: N/A

Release description N/A

Code Examples N/A

Minor update: 1.17.0 → 1.18.0

$ DOWNLOADS TREND

18.6M26.9M

$ VERSION HISTORY

v1.18.0February 25, 2026
v1.17.0October 13, 2025
v1.16.0September 14, 2025

$ LINKS

$ INSTALL

cargo add const-hex

Or add to Cargo.toml: const-hex = "1.18.0"