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 20131/week @ 2025-01-04 20384/week @ 2025-01-11 20902/week @ 2025-01-18 24023/week @ 2025-01-25 25927/week @ 2025-02-01 30664/week @ 2025-02-08 19758/week @ 2025-02-15 14477/week @ 2025-02-22 18805/week @ 2025-03-01 18880/week @ 2025-03-08 21701/week @ 2025-03-15 24564/week @ 2025-03-22 26368/week @ 2025-03-29 26559/week @ 2025-04-05 20919/week @ 2025-04-12 17162/week @ 2025-04-19

95,178 downloads per month
Used in 53 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]);

No runtime deps