wiwi/encoding/
base16.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use crate::prelude_std::*;
use super::hex::{
	encode_hex,
	encode_hex_upper,
	decode_hex
};

pub use super::hex::{
	DecodeError,
	TABLE_ENCODER_LEN,
	TABLE_ENCODER_LOWER,
	TABLE_ENCODER_UPPER
};

#[inline]
pub fn encode_base16(bytes: &[u8]) -> String {
	encode_hex(bytes)
}

#[inline]
pub fn encode_base16_upper(bytes: &[u8]) -> String {
	encode_hex_upper(bytes)
}

#[inline]
pub fn decode_base16(bytes: &[u8]) -> Result<Vec<u8>, DecodeError> {
	decode_hex(bytes)
}