pub fn bin2hex<'a>(
input: &[u8],
output: &'a mut [u8]
) -> Result<&'a mut [u8], ConvertError>
Expand description
Base16 Encoder - Converts binary to base16 (hex)
Example
use binascii::bin2hex;
let mut buffer = [0u8; 200];
let input = "Hello, World!";
println!("hex({}) = {:?}", input, bin2hex(input.as_bytes(), &mut buffer).ok().unwrap());
Failures
This function will fail with:
ConvertError::InvalidOutputLength
- If theoutput
’s length isn’t at least 2 times theinput
length.