Skip to main content

Abjad Encoded ID – 128-bit IDs encoded as 32 consonant-only ASCII characters

Project description

AEID: Abjad Encoded ID

Consonant-only encoding for 128-bit identifiers (ULID/UUID), designed for LLM contexts.

AEID encodes 128-bit values as 32-character ASCII strings using only 16 consonant letters (B C D F G H K L M N P R S T V W). No vowels means no accidental English words, eliminating semantic bias when LLMs handle IDs.

ULID:  01KC9R38FJH1XRVWJZBJRRCV5A
AEID:  BCNRCFMCPCWDMMLRMTWDHWHSRCMKKSPP

Why?

Problem AEID Solution
LLMs hallucinate ID characters 32-char redundancy enables LCS-based error recovery
Alphanumeric IDs form English words Vowel-free alphabet makes word formation impossible
Non-Latin scripts destabilize LLM output ASCII-only, no language switching
Rare characters waste tokens All 256 byte-pairs are single BPE tokens

Install

pip install aeid                # core
pip install aeid[pydantic]      # + Pydantic support

Usage

AEID class (extends ULID)

from aeid import AEID

# Generate
a = AEID()                                          # new with current timestamp
a = AEID.from_str("BCNRCFMCPCWDMMLRMTWDHWHSRCMKKSPP")  # from AEID string
a = AEID.from_str("01KC9R38FJH1XRVWJZBJRRCV5A")        # from ULID string

# Convert
str(a)          # "BCNRCFMC..."   AEID (32 chars)
a.ulid_str      # "01KC9R38..."   ULID (26 chars)
a.datetime      # datetime(...)   timestamp
a.to_uuid()     # UUID(...)
int(a)          # 128-bit integer

# All ULID factory methods work
AEID.from_datetime(dt)
AEID.from_timestamp(time.time())
AEID.from_uuid(uuid_obj)
AEID.from_int(value)
AEID.parse(any_format)           # auto-detect AEID/ULID/hex/bytes/int

Low-level functions

from aeid import encode, decode, resolve

encode(0x019b1381a1f2887b8df25f5cb1866caa)
# "BCNRCFMCPCWDMMLRMTWDHWHSRCMKKSPP"

decode("BCNRCFMCPCWDMMLRMTWDHWHSRCMKKSPP")
# 0x019b1381a1f2887b8df25f5cb1866caa

# LCS-based error recovery
resolve(corrupted_id, candidate_list)

Pydantic

from pydantic import BaseModel
from aeid import AEID

class Record(BaseModel):
    id: AEID

r = Record(id="BCNRCFMCPCWDMMLRMTWDHWHSRCMKKSPP")  # validates AEID
r = Record(id="01KC9R38FJH1XRVWJZBJRRCV5A")         # validates ULID too
r.model_dump_json()  # {"id": "BCNRCFMCPCWDMMLRMTWDHWHSRCMKKSPP"}

Encoding

Each byte is mapped to a 2-character pair using a 256-entry lookup table:

byte value  ->  ALPHABET[high nibble] + ALPHABET[low nibble]
0x00 -> BB,  0x01 -> BC,  ...  0xFF -> WW

16 bytes (128 bits) produce 32 characters. The encoding preserves sort order: lexicographic order of AEID strings matches the numeric order of the underlying values.

Specification

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aeid-0.1.0.tar.gz (30.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aeid-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file aeid-0.1.0.tar.gz.

File metadata

  • Download URL: aeid-0.1.0.tar.gz
  • Upload date:
  • Size: 30.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aeid-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ecf63962cd3bb73736674daeb4a61140e7c1ecc330e8a5d5652ed7e7decaa8bc
MD5 f176e4dd1ac6bafcfc26002ebdc91e5f
BLAKE2b-256 ec91e514664f5c334f78aae4f8b211792ff0aff5a3db4ceae23637c0aab39a59

See more details on using hashes here.

File details

Details for the file aeid-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: aeid-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aeid-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eda4acd78054414c3fd9bdfc9748322fc43c16b1643816de0c8837ff2a8f72de
MD5 59dd5febb4e7d4397ca20a812d6693d5
BLAKE2b-256 862fd293709a25b91375a4acfc316721b5b61521f3e2bac5f74753962d2896cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page