Skip to main content

base28

A confusable-hardened symbol encoding for short, printed, human-transcribable codes. Crockford base32 with 2, 5, S, and Z removed: 28 symbols, fixed-width integer encoding, Damm check symbol that catches any single wrong symbol or adjacent transposition.

Normative specification: SPEC.md. Frozen artifacts: damm_table.json, test-vectors.json.

Install

uv add base28          # or: pip install base28

Library

The everyday surface is the rev45 profile: a 45-bit value as an XXX-XXXX-XXXX code.

from base28 import rev45

rev45.encode(2832504837759)     # '09F-WWAH-NMTK'
rev45.encode_compact(2832504837759)  # '09FWWAHNMTK'
rev45.decode('09f-wwah-nmtk')   # 2832504837759  (case, spaces, I/L/O tolerated)

The generic width mechanism (any width in 1..128 bits) is available directly:

import base28

base28.encode(0, 45)            # '00000000000'
base28.decode('00000000000', 45)  # 0
base28.symbol_count(45)         # 10

Decode failures raise a subclass of base28.Base28Error (Overflow, InvalidCharacter, ExcludedConfusable, WrongLength, CheckMismatch), so callers can reject an input or explain what to fix.

CLI

base28 encode 2832504837759     # 09F-WWAH-NMTK
base28 encode 2832504837759 --compact   # 09FWWAHNMTK
base28 encode 999 --bits 20     # generic width, ungrouped
base28 decode 09f-wwah-nmtk     # 2832504837759
base28 verify                   # re-check the frozen test vectors independently

Development

uv sync
uv run pytest             # property, vector, rev45, and CLI tests
uv run ruff check .
uv run basedpyright

The frozen artifacts are regenerated (and re-verified) by the dev-only scripts under tools/:

uv run python -m tools.generate_damm_table   # writes src/base28/data/damm_table.json
uv run python -m tools.generate_vectors      # writes src/base28/data/test-vectors.json

Release files for base28 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for base28 0.1.1
File Size Uploaded
base28-0.1.1.tar.gz 134.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for base28 0.1.1
File Interpreter ABI Platform
base28-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 147.3 kB

Release files / base28-0.1.1.tar.gz

Download URL base28-0.1.1.tar.gz
Size 134.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9b03a5e1aa0baee5af6e5041fd9a30dcea7c6f5258ee450f87c86da7fafd306b
BLAKE2b-256 checksum
How to use checksums
0c33c6a3e376d73fc53688f6971951f381c0be40089e52f8d638149282364479
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / base28-0.1.1-py3-none-any.whl

Download URL base28-0.1.1-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb58ac6602b42a3b98e2f83feb7eaef1e0fbbd2ad93a0d11c54da784c80c0810
BLAKE2b-256 checksum
How to use checksums
cb71ee552d732c1af462c92009cde778e4f377dfd238fd4156f9d62281a12c15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page