diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2019-01-06 00:20:04 +0100 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2019-01-13 18:37:08 -0800 |
commit | cb5b22d0886a0a8c19cf1afeef55a8245357cf20 (patch) | |
tree | cfcc555186317bac4f4383a9380e0d6ef6d58459 /base32/README.md | |
parent | 38e7e1d92ce4aea7840d78bcda6246bd61c423ac (diff) | |
download | nitrocli-cb5b22d0886a0a8c19cf1afeef55a8245357cf20.tar.gz nitrocli-cb5b22d0886a0a8c19cf1afeef55a8245357cf20.tar.bz2 |
Add the base32 crate in version 0.4.0 as a dependency
To parse OTP secrets in base32 representation, we need a new dependency:
the base32 crate.
Import subrepo base32/:base32 at a74cd9246fc0e08d6f5cfcb644bfdf76dd438613
Diffstat (limited to 'base32/README.md')
-rw-r--r-- | base32/README.md | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/base32/README.md b/base32/README.md new file mode 100644 index 0000000..86d9ad9 --- /dev/null +++ b/base32/README.md @@ -0,0 +1,35 @@ +# base32 [![Build Status](https://travis-ci.org/andreasots/base32.svg?branch=master)](https://travis-ci.org/andreasots/base32) + +This library lets you encode and decode in either [RFC4648 Base32](http://en.wikipedia.org/wiki/Base32#RFC_4648_Base32_alphabet) or in [Crockford Base32](http://en.wikipedia.org/wiki/Base32#Crockford.27s_Base32). + +# Usage + +```rust +// 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 + + * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) + * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) + +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. |