[][src]Crate koibumi_base32

This crate is a Base32 encoder/decoder library without padding.

Intended to use to implement an Onion address encoder/decoder. Using RFC 4648 Base32 alphabet, but encoded string is lowercase by default.

This crate does not support padding, so the input length for the encode function is limited to multiple of 5 and the input length for the decode function is limited to multiple of 8.

Examples

use koibumi_base32 as base32;

let test = base32::encode(b"hello")?;
let expected = "nbswy3dp";
assert_eq!(test, expected);
use koibumi_base32 as base32;

let test = base32::decode("nbswy3dp")?;
let expected = b"hello";
assert_eq!(test, expected);

Enums

DecodeError

An error which can be returned when decoding a Base32 encoded string.

EncodeError

An error which can be returned when encoding a byte array into Base32 format.

Functions

decode

Decodes Base32 string into byte array.

encode

Encodes byte array into Base32 string.