mnemonic

Crates.iomnemonic
lib.rsmnemonic
version1.1.1
sourcesrc
created_at2017-01-14 23:26:40.337325
updated_at2024-03-18 14:42:24.826941
descriptionEncode any data into a sequence of English words
homepage
repositoryhttps://github.com/mbrubeck/rust-mnemonic
max_upload_size
id8068
size37,925
Matt Brubeck (mbrubeck)

documentation

https://docs.rs/mnemonic

README

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]);
Commit count: 15

cargo fmt