Skip to main content

hardguard25

These lengths apply to lookup identifiers, not bearer or authentication secrets.

Python reference implementation of HardGuard25 — an open standard for human-safe identifiers.

Literal

0 1 2 3 4 5 6 7 8 9 A C D F G H J K M N P R U W Y

HardGuard25 is a 25-character alphabet designed to exclude common visual confusables, including patterns relevant to dyslexia-sensitive workflows. It removes 11 letters associated with predictable confusion (I L O B S Z E T V X Q). When a letter and a digit compete for the same visual slot, the digit always wins. Comparative OCR and transcription error rates have not yet been established empirically.

Install

Literal

pip install hardguard25

Installed wheels require Python 3.9+. Building from source requires Python 3.10+ and setuptools 84.1.0 or newer.

Quickstart

Literal

from hardguard25 import generate, validate, normalize, check_digit, verify_check_digit

generate(8)                       # e.g. "AC3H7PUW"
generate(8, check_digit=True)     # e.g. "AC3H7PUWN"  (length+1)

validate("ac3h-7puw")             # True  (case and separators tolerated)
normalize("ac3h-7puw")            # "AC3H7PUW"

check_digit("AC3H7PUW")           # "N"
verify_check_digit("AC3H7PUWN")   # True

Normalization removes the Unicode White_Space set pinned by the specification plus -, _, and ., and rejects empty or separator-only input. Validation returns False for invalid input, and check-digit calculation rejects an empty payload.

API

Function Purpose
generate(length, *, check_digit=False) Cryptographically secure random ID using rejection sampling for uniform distribution
validate(s) True if s normalizes to a valid HardGuard25 ID; never raises
normalize(s) Remove pinned Unicode White_Space and - _ ., uppercase, and reject other characters
check_digit(code) Mod-25 weighted check digit for manual-entry error detection
verify_check_digit(code) Strip last char, recompute, compare
ALPHABET "0123456789ACDFGHJKMNPRUWY"

Type hints and py.typed marker included.

Sizing

Each character carries log2(25) = 4.64 bits of entropy.

Length Bits Possible Strings Typical Use
4 18.6 390,625 Small inventory, tickets
5 23.2 9,765,625 Small business
6 27.9 244,140,625 Medium businesses
7 32.5 6.1 billion Large catalogs
8 37.2 152.6 billion Large systems
12 55.7 5.96 × 10¹⁶ Internal identifiers
16 74.3 2.33 × 10²² Cross-system IDs
20 92.9 9.09 × 10²⁷ Public lookup identifiers
22 102.2 5.68 × 10³⁰ Internet-scale

These values are possible payload strings, not safe random issuance counts. Random issuance must account for birthday collisions. An appended check digit is derived from the payload and does not add random entropy.

Recommended defaults:

  • 16 for internal systems up to millions of IDs
  • 20 for public lookup identifiers or cross-org use
  • 22 for long-lived, internet-scale identifiers

See the spec for collision-bound tables.

Implementation guidance

For project integration guidance, see:

When NOT to Use HardGuard25

  • Cryptographic keys (use proper key derivation)
  • Blockchain consensus (use domain-specific formats)
  • Systems requiring global UUID guarantees (use UUIDv7 or ULID)
  • Machine-only contexts where no human ever sees the ID

Reference

License

MIT

Metadata

Release files for hardguard25 1.3.10

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

Source distribution (sdist)

Source distribution for hardguard25 1.3.10
File Size Uploaded Provenance Actions
hardguard25-1.3.10.tar.gz 6.6 kB With provenance Details for hardguard25-1.3.10.tar.gz

Built distribution (wheel)

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

Total release size: 13.5 kB

Release files / hardguard25-1.3.10.tar.gz

Download URL hardguard25-1.3.10.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f5695b5194aabbdb5ef5886fb549b9165d996a2e0b95ac86c6b35e0db1c46f98
BLAKE2b-256 checksum
How to use checksums
628ab069099d548483903f21acd36c95f06d9d02c79dc62789304b2c0c2e430d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / hardguard25-1.3.10-py3-none-any.whl

Download URL hardguard25-1.3.10-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c7cef7a281dcbe277c6ec6a39be532d12589ddeb9889e92793a3db9e2373118
BLAKE2b-256 checksum
How to use checksums
81c2f33c6778ca4a642c982484ebe618c26db6a78e1cb047f188483e8c4a1d8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for hardguard25 1.3.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hardguard25-1.3.10.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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