base45

Visionary Software Solutions Base45: RFC 9285 base45 binary-to-text codec

Encode bytes as Base45 text and decode that text back to bytes, over the alphabet of RFC 9285, which a QR code holds compactly. The text is typed by that alphabet.

Key Concepts

Codec contract

Role. Factory.INSTANCE makes a software.visionary.cuneiform.codec.Codec whose text holds the constants of Base45. deserialize encodes bytes as Encoded data, whose toString() is the text; read takes text to encoded data, and serialize decodes that to bytes.

Alphabet

Role. Base45 is an enum of 0–9, A–Z, the space and $ % * + - . / :, whose constants pick their glyphs. A constant's place in the enum is its base-45 digit.

Base conversion

Role. Base45 converts numbers; it does not regroup bits. Two bytes are a number written as three digits, least significant first, and a last single byte is written as two.

Usage

Round-trip bytes through Base45

import java.util.Arrays;
import software.visionary.base45.Base45;
import software.visionary.base45.Factory;
import software.visionary.cuneiform.codec.Codec;

class Base45RoundTrip {
    public static void main(String[] args) {
        Codec<Base45> codec = Factory.INSTANCE.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.cuneiform:codec:2026.10.13 at Compile
  • software.visionary:spex-closure:2026.10.13 at Testing

Caveats

  • Reading refuses every character outside the alphabet; the space belongs to it, so it must be kept. Decoding refuses a lone last symbol and a group whose number is more than its bytes hold.

Views

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

architecture.svg
architecture.svg
classes.software.visionary.base45.svg
classes.software.visionary.base45.svg
packages.svg
packages.svg