4 stable releases

1.1.1 Mar 18, 2024
1.0.1 Dec 19, 2018
1.0.0 Jan 14, 2017

#42 in Authentication

Download history 10037/week @ 2024-07-17 9742/week @ 2024-07-24 9289/week @ 2024-07-31 7731/week @ 2024-08-07 9696/week @ 2024-08-14 9319/week @ 2024-08-21 9656/week @ 2024-08-28 10683/week @ 2024-09-04 6953/week @ 2024-09-11 8243/week @ 2024-09-18 10333/week @ 2024-09-25 11369/week @ 2024-10-02 9853/week @ 2024-10-09 16511/week @ 2024-10-16 11228/week @ 2024-10-23 13498/week @ 2024-10-30

53,749 downloads per month
Used in 40 crates (7 directly)

MIT license

34KB
502 lines

mnemonic

This is a Rust port of the mnemonic encoder originally written in C by Oren Tirosh and available from:

https://github.com/singpolyma/mnemonicode

These routines implement a method for encoding binary data into a sequence of words which can be spoken over the phone, for example, and converted back to data on the other side.

For more information, see:

http://web.archive.org/web/20101031205747/http://www.tothink.com/mnemonic/

Example

let bytes = [101, 2, 240, 6, 108, 11, 20, 97];

let s = mnemonic::to_string(&bytes);
assert_eq!(s, "digital-apollo-aroma--rival-artist-rebel");

let mut decoded = Vec::<u8>::new();
mnemonic::decode(s, &mut decoded).unwrap();

assert_eq!(decoded, [101, 2, 240, 6, 108, 11, 20, 97]);

lib.rs:

This is a Rust port of the mnemonic encoder originally written in C by Oren Tirosh and available from:

https://github.com/singpolyma/mnemonicode

These routines implement a method for encoding binary data into a sequence of words which can be spoken over the phone, for example, and converted back to data on the other side.

For more information, see:

http://web.archive.org/web/20101031205747/http://www.tothink.com/mnemonic/

Example

let bytes = [101, 2, 240, 6, 108, 11, 20, 97];

let s = mnemonic::to_string(&bytes);
assert_eq!(s, "digital-apollo-aroma--rival-artist-rebel");

let mut decoded = Vec::<u8>::new();
mnemonic::decode(s, &mut decoded).unwrap();

assert_eq!(decoded, [101, 2, 240, 6, 108, 11, 20, 97]);

No runtime deps