8 releases

Uses old Rust 2015

0.4.0 Oct 23, 2018
0.3.1 Jan 11, 2016
0.3.0 Apr 8, 2015
0.2.3 Mar 5, 2015
0.1.1 Nov 22, 2014

#368 in Encoding

Download history 39149/week @ 2023-12-13 29267/week @ 2023-12-20 14235/week @ 2023-12-27 41364/week @ 2024-01-03 32305/week @ 2024-01-10 41568/week @ 2024-01-17 42937/week @ 2024-01-24 42263/week @ 2024-01-31 50156/week @ 2024-02-07 46647/week @ 2024-02-14 45642/week @ 2024-02-21 53374/week @ 2024-02-28 55150/week @ 2024-03-06 53649/week @ 2024-03-13 51040/week @ 2024-03-20 51314/week @ 2024-03-27

221,261 downloads per month
Used in 313 crates (106 directly)

MIT/Apache

11KB
197 lines

base32 Build Status

This library lets you encode and decode in either RFC4648 Base32 or in Crockford Base32.

Usage

// crockford base32
assert_eq!(encode(CrockfordBase32, [0xF8, 0x3E, 0x0F, 0x83, 0xE0]), Vec::from_slice("Z0Z0Z0Z0".to_ascii()));
assert_eq!(decode(CrockfordBase32, "Z0Z0Z0Z0".to_ascii()).unwrap(), vec![0xF8, 0x3E, 0x0F, 0x83, 0xE0]);

// rfc4648 base32
assert_eq!(encode(RFC4648Base32, [0xF8, 0x3E, 0x7F, 0x83, 0xE7]), Vec::from_slice("7A7H7A7H".to_ascii()));
assert_eq!(decode(RFC4648Base32, "7A7H7A7H".to_ascii()).unwrap(), vec![0xF8, 0x3E, 0x7F, 0x83, 0xE7]);

// rfc4648 base32 without padding characters (=)
assert_eq!(encode(UnpaddedRFC4648Base32, [0xF8, 0x3E, 0x7F, 0x83, 0xE7]), Vec::from_slice("7A7H7A7H".to_ascii()));
assert_eq!(decode(UnpaddedRFC4648Base32, "7A7H7A7H".to_ascii()).unwrap(), vec![0xF8, 0x3E, 0x7F, 0x83, 0xE7]);

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

No runtime deps