| Crates.io | base32h |
| lib.rs | base32h |
| version | 0.2.0 |
| created_at | 2020-09-21 02:05:01.270061+00 |
| updated_at | 2020-09-23 00:27:52.054229+00 |
| description | Base32H for rust |
| homepage | |
| repository | https://github.com/jdon/Base32H/ |
| max_upload_size | |
| id | 290988 |
| size | 15,202 |
An implementation of base32. Built following the spec and test cases from https://base32h.github.io/
cargo add base32h
use base32h::{encode_binary_to_string, encode_to_string, decode_string_to_binary, decode_string};
assert_eq!(encode_to_string(1099511627775).unwrap(), "ZZZZZZZZ".to_owned());
assert_eq!(decode_string("ZZZZZZZZ"), Some(1099511627775));
assert_eq!(encode_binary_to_string(&[255, 255, 255, 255, 255, 255]), "0000007ZZZZZZZZZ".to_owned());
assert_eq!(decode_string_to_binary("zZzZzZzZ"), Vec::from([255, 255, 255, 255, 255]));
Run:
cargo test
Run:
cargo bench
Install cargo fuzz:
cargo install cargo-fuzz
Run one of the fuzzing targets (Must be on nightly):
cargo fuzz run encode_binary_to_string -j 8 // 8 is the number of threads to usecargo fuzz run decode_string_to_binary -j 8cargo fuzz run encode_to_string -j 8cargo fuzz run decode_string -j 8