Skip to main content

Crate covo

Crate covo 

Source
Expand description

§covo

Consonant-vowel binary encoding for human-pronounceable strings.

let encoded = covo::encode(b"\xCA\xFE");
assert_eq!(encoded, "bafaba-roputa");
assert_eq!(covo::decode(&encoded).unwrap(), b"\xCA\xFE");

Encoded strings include a checksum and are self-describing: decode only needs the alphabet, not the encoder’s configuration. Non-alphabet characters are silently ignored, so separators and whitespace are transparent to the decoder.

Use encode / decode with defaults, or encode_with / decode_with for a custom Alphabet or Config.

Custom alphabets accept English consonants and vowels only (for simplicity and pronounceability).

Structs§

Alphabet
Config
ConfigBuilder

Enums§

AlphabetError
ConfigError
DecodeError
Padding

Constants§

BITS_PER_PAIR
Encoded bits per CV pair: 4 (consonant) + 2 (vowel).
DEFAULT
DEFAULT_ALPHABET
DEFAULT_CONSONANTS
Default consonants.
DEFAULT_GROUP_SIZE
Default number of CV pairs (not characters) per group.
DEFAULT_SEPARATOR
DEFAULT_VOWELS
Default vowels.
MAX_GROUP_SIZE
Maximum group size. The pad_count header field is 3 bits (0-7), so at most 7 padding pairs can be encoded — but groups that large are impractical (try repeating “vikuhajasovisoju-robinikarobiluju”, two 8-pair groups).
NUM_CONSONANTS
Number of consonants in the alphabet.
NUM_VOWELS
Number of vowels in the alphabet.

Functions§

decode
Decode a covo string with the default alphabet.
decode_with
Decode a covo string with the given alphabet.
encode
Encode binary data with DEFAULT config.
encode_with
Encode binary data with the given configuration.