4 stable releases

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

#107 in Authentication

Download history 18518/week @ 2025-09-27 18410/week @ 2025-10-04 15852/week @ 2025-10-11 15742/week @ 2025-10-18 20080/week @ 2025-10-25 16250/week @ 2025-11-01 14650/week @ 2025-11-08 22805/week @ 2025-11-15 16905/week @ 2025-11-22 24265/week @ 2025-11-29 21751/week @ 2025-12-06 17523/week @ 2025-12-13 5411/week @ 2025-12-20 4486/week @ 2025-12-27 16922/week @ 2026-01-03 30173/week @ 2026-01-10

60,225 downloads per month
Used in 65 crates (9 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