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
Not yet published to PyPI. Install from a checkout:
uv pip install . # from the repo root
Once published: 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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| base28-0.1.0.tar.gz | 134.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| base28-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 147.2 kB
Release files / base28-0.1.0.tar.gz
| Download URL | base28-0.1.0.tar.gz |
|---|---|
| Size | 134.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
404788a83eef29dc6b4c11c964b4cf6a57ea911204664b2b6b6149987e5a1c6f
|
|
BLAKE2b-256 checksum How to use checksums |
211b9add1ff42e2dfa9b0ad119a50cb557f067ab9e52acdf9a0fdfcbc942a51e
|
| 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.0-py3-none-any.whl
| Download URL | base28-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
04bc910f759847b6fbf697d48f245344a24552f6e3c1f2b77cfab9cd36a219fe
|
|
BLAKE2b-256 checksum How to use checksums |
e6203eb3fe3aaca3af757bba75e3a20ae00e4fbb3b74a5698e4e4a1d77d36726
|
| 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}
|