Expand description
This crate provides an implementation of a Bubble Babble encoder and decoder.
The Bubble Babble encoding uses alternation of consonants and vowels to encode binary data to pseudowords that can be pronounced more easily than arbitrary lists of hexadecimal digits.
Bubble Babble is part of the Digest libraries in Perl and Ruby.
§Usage
You can encode binary data by calling encode
:
let encoded = boba::encode("Pineapple");
assert_eq!(encoded, "xigak-nyryk-humil-bosek-sonax");
Decoding binary data is done by calling decode
:
let decoded = boba::decode("xexax")?;
assert_eq!(decoded, vec![]);
Decoding data is fallible and can return DecodeError
. For example, all
Bubble Babble–encoded data has an ASCII alphabet, so attempting to decode an
emoji will fail.
let decoded = boba::decode("x🦀x");
// The `DecodeError` contains the offset of the first invalid byte.
assert_eq!(decoded, Err(DecodeError::InvalidByte(1)));
§Crate Features
Boba is no_std
compatible with a required dependency on the alloc
crate.
Enums§
- Decode
Error - Decoding errors from
boba::decode
.