base-encode

Crates.iobase-encode
lib.rsbase-encode
version0.3.1
sourcesrc
created_at2019-04-11 13:15:23.20733
updated_at2019-10-08 17:54:23.145427
descriptionEncode and decode data to any base.
homepage
repositoryhttps://github.com/janispritzkau/rust-base-encode
max_upload_size
id127247
size10,749
Janis Pritzkau (janispritzkau)

documentation

https://docs.rs/base-encode

README

base-encode

crate docs.rs

Encode and decode data from and to any base from 2 to 256.

use base_encode::{encode, decode};

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

// leading zeros are preserved
decode(&[0, 0, 2, 5, 6], 10) // [0, 0, 1, 0]

Convert from and to strings

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

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

cargo fmt