Skip to main content

hex_encode

Function hex_encode 

Source
pub fn hex_encode(data: &[u8]) -> String
Expand description

Hex-encode data as lowercase ASCII (two characters per byte).

The output is exactly 2 * data.len() characters, zero-padded per byte, with no separators and no 0x prefix — the form every wire format in this workspace uses.

use broadcast_common::hex::hex_encode;

assert_eq!(hex_encode(&[0x00, 0x0f, 0xff]), "000fff");
assert_eq!(hex_encode(&[]), "");