2 stable releases

1.0.1 Dec 19, 2018
1.0.0 Jan 14, 2017

#99 in Authentication

Download history 1244/week @ 2021-10-04 1202/week @ 2021-10-11 1325/week @ 2021-10-18 666/week @ 2021-10-25 886/week @ 2021-11-01 1015/week @ 2021-11-08 919/week @ 2021-11-15 704/week @ 2021-11-22 738/week @ 2021-11-29 1229/week @ 2021-12-06 1303/week @ 2021-12-13 928/week @ 2021-12-20 181/week @ 2021-12-27 405/week @ 2022-01-03 834/week @ 2022-01-10 1004/week @ 2022-01-17

2,424 downloads per month
Used in 2 crates

MIT license

33KB
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