bytes_to_hexstring

Function bytes_to_hexstring 

pub fn bytes_to_hexstring(bytes: &[u8]) -> String
Expand description

字节数组转换为十六进制字符串(Convert Byte Array to Hex String)

§参数(Arguments)

  • bytes - 字节数组(Byte Array)

§示例(Examples)

use neuedu_cryptos::utils::bytes_to_hexstring;

const BYTES: [u8; 32] = [
    0x66, 0xC7, 0xF0, 0xF4, 0x62, 0xEE, 0xED, 0xD9,
    0xD1, 0xF2, 0xD4, 0x6B, 0xDC, 0x10, 0xE4, 0xE2,
    0x41, 0x67, 0xC4, 0x87, 0x5C, 0xF2, 0xF7, 0xA2,
    0x29, 0x7D, 0xA0, 0x2B, 0x8F, 0x4B, 0xA8, 0xE0,
];

let hex_string = bytes_to_hexstring(&BYTES);

assert_eq!(hex_string, "66c7f0f462eeedd9d1f2d46bdc10e4e24167c4875cf2f7a2297da02b8f4ba8e0");