[][src]Crate base_encode

Functions for encoding data into any base from 2 to 256.

Example

use base_encode::*;

let data = vec![0x27, 0x10];
encode(&data, 10) // [1, 0, 0, 0, 0]

Leading zeros are preserved.

encode(&[0, 0, 128], 36) // [0, 0, 3, 14]
decode(&[0, 2, 5, 6], 10) // [0, 1, 0]

Encode / decode strings

from_str("255", 10, b"0123456789").unwrap() // [0xff]

to_string(&[0xa], 2, b"OX").unwrap() // "XOXO"

Modules

utils

Functions

decode

Decodes a base encoded u8 slice into bytes.

encode

Encodes a u8 slice to any base.

from_str

Converts a base encoded string to bytes using the specified character table.

to_string

Converts bytes to a base encoded string using the specified character table.