4 stable releases

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

#35 in Authentication

Download history 6593/week @ 2024-01-03 6821/week @ 2024-01-10 11377/week @ 2024-01-17 10344/week @ 2024-01-24 6561/week @ 2024-01-31 6777/week @ 2024-02-07 8832/week @ 2024-02-14 11234/week @ 2024-02-21 7832/week @ 2024-02-28 11139/week @ 2024-03-06 13263/week @ 2024-03-13 11796/week @ 2024-03-20 8791/week @ 2024-03-27 11628/week @ 2024-04-03 10895/week @ 2024-04-10 11206/week @ 2024-04-17

45,516 downloads per month
Used in 37 crates (6 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