Function to_hex

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

Converts binary data to a lowercase hexadecimal string.

Each byte is represented as two hexadecimal digits (0-9, a-f).

§Arguments

  • data - The binary data to convert

§Returns

Returns the hexadecimal string representation.

§Examples

use ruscrypt::utils::to_hex;
 
let data = &[0x48, 0x65, 0x6c, 0x6c, 0x6f]; // "Hello" in ASCII
let hex = to_hex(data);
assert_eq!(hex, "48656c6c6f");