4 stable releases

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

#52 in Authentication

Download history 10732/week @ 2024-08-18 8961/week @ 2024-08-25 10858/week @ 2024-09-01 8457/week @ 2024-09-08 6986/week @ 2024-09-15 10539/week @ 2024-09-22 9317/week @ 2024-09-29 10969/week @ 2024-10-06 14218/week @ 2024-10-13 12819/week @ 2024-10-20 12113/week @ 2024-10-27 12530/week @ 2024-11-03 7148/week @ 2024-11-10 11385/week @ 2024-11-17 14418/week @ 2024-11-24 17283/week @ 2024-12-01

50,852 downloads per month
Used in 49 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