base32

Visionary Software Solutions Base32: RFC 4648 and Crockford base32 binary-to-text codecs

Encode binary data as Base32 text over the RFC 4648 standard alphabet, its Extended Hex alphabet, or Crockford's alphabet. The text is typed by its alphabet. Choose a factory for the required alphabet and its padding or hyphen policy.

Key Concepts

Codec contract

Role. Each alphabet's Factory makes a codec over that alphabet: RFC 4648's two make a software.visionary.rfc4648.Codec, and Crockford's a software.visionary.cuneiform.codec.Codec of the same symbols. deserialize encodes bytes as Encoded data, whose toString() is the text; read takes text to encoded data, and serialize decodes that to bytes.

Alphabet selection

Role. rfc4648.Base32 and rfc4648hex.Base32Hex are RFC 4648's two alphabets, and their factories offer PADDED and UNPADDED codecs. crockford.Crockford is Crockford's, and its factory offers TOLERANT, which leaves hyphen separators out as it reads, and STRICT, which refuses them.

Usage

Choose an alphabet and policy

Package      Alphabet                 Factory choices
rfc4648      RFC 4648 standard         PADDED / UNPADDED
rfc4648hex   RFC 4648 Extended Hex     PADDED / UNPADDED
crockford    Crockford                TOLERANT / STRICT

Round-trip bytes with unpadded RFC 4648 Base32

import java.util.Arrays;
import software.visionary.base32.rfc4648.Base32;
import software.visionary.base32.rfc4648.Factory;
import software.visionary.rfc4648.Codec;

class Base32RoundTrip {
    public static void main(String[] args) {
        Codec<Base32> codec = Factory.UNPADDED.create();
        byte[] original = {0x12, 0x34, (byte) 0xAB};
        String written = codec.deserialize(original).toString();
        System.out.println(written + " " + Arrays.equals(original, codec.serialize(codec.read(written))));
    }
}

Dependencies

  • software.visionary:rfc4648:2026.10.13 at Compile
  • software.visionary.spex:carlin:2026.10.13 at Compile
  • software.visionary:spex-closure:2026.10.13 at Testing

Caveats

  • RFC 4648 reading refuses lowercase letters and every character outside the selected alphabet. Crockford's strict codec refuses hyphens; it still reads a lowercase letter as its uppercase, I and L as 1, and O as 0.

Views

Drawn from the release. A link in a view opens its source at the release tag.

architecture.svg
architecture.svg
classes.software.visionary.base32.crockford.svg
classes.software.visionary.base32.crockford.svg
classes.software.visionary.base32.rfc4648.svg
classes.software.visionary.base32.rfc4648.svg
classes.software.visionary.base32.rfc4648hex.svg
classes.software.visionary.base32.rfc4648hex.svg
packages.svg
packages.svg