Skip to content

Encode data to different bases from base 2 to base 256

Notifications You must be signed in to change notification settings

janispritzkau/rust-base-encode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"

About

Encode data to different bases from base 2 to base 256

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages