encode

Function encode 

Source
pub fn encode(data: &[u8], dictionary: &WordDictionary) -> String
Expand description

Encodes binary data as a sequence of words.

Uses radix (base) conversion where each “digit” is a word from the dictionary. Words are joined by the dictionary’s delimiter.

§Example

use base_d::{WordDictionary, word};

let dict = WordDictionary::builder()
    .words(vec!["abandon", "ability", "able", "about"])
    .delimiter(" ")
    .build()
    .unwrap();

let encoded = word::encode(b"\x00\x01\x02", &dict);
// Result is words joined by spaces