2 stable releases

1.0.1 Dec 19, 2018
1.0.0 Jan 14, 2017

#164 in Authentication

Download history 4939/week @ 2023-06-03 6988/week @ 2023-06-10 6064/week @ 2023-06-17 8547/week @ 2023-06-24 7328/week @ 2023-07-01 5810/week @ 2023-07-08 5721/week @ 2023-07-15 8353/week @ 2023-07-22 5572/week @ 2023-07-29 7094/week @ 2023-08-05 11230/week @ 2023-08-12 9207/week @ 2023-08-19 10171/week @ 2023-08-26 7088/week @ 2023-09-02 4942/week @ 2023-09-09 6192/week @ 2023-09-16

29,868 downloads per month
Used in 23 crates (6 directly)

MIT license

34KB
500 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]);

Dependencies

~130KB