Skip to main content

python-codex32

Reference implementation of BIP-0093 (codex32): checksummed, SSSS-aware BIP32 seed strings.

This repository implements the codex32 string format described by BIP-0093. It provides encoding/decoding, regular/long codex32 checksums, CRC padding for base conversions, Shamir secret sharing scheme (SSSS) interpolation helpers and helpers to build codex32 strings from seed bytes.

Features

  • Encode/decode codex32 data via from_string and from_unchecksummed_string.
  • Regular checksum (13 chars) and long checksum (15 chars) support.
  • Construct codex32 strings from raw seed bytes via from_seed.
  • CRC-based default padding scheme for from_seed.
  • Default from_seed identifier is the bech32-encoded BIP32 fingerprint.
  • Interpolate/recover shares via interpolate_at.
  • Parse codex32 strings and access parts via properties.
  • Mutate codex32 strings by reassigning is_upper, hrp, k, ident, share_idx, data, and pad_val.
  • Contains module and tests for Bech32/Bech32m and segwit addresses.

Security

Caution: This is reference code. Verify carefully before using with real funds.

Installation

Compatibility: Python 3.10–3.14

Recommended: use a virtual environment

Linux / macOS

python -m venv .venv
source .venv/bin/activate
pip install codex32

Windows

python -m venv .venv
.venv\Scripts\Activate.ps1
pip install codex32

Quick usage

from codex32 import Codex32String

# Create from seed bytes
s = Codex32String.from_seed(
    bytes.fromhex('ffeeddccbbaa99887766554433221100'),
    "ms13cashs",        # prefix string, (HRP + '1' + header)
    0                   # padding value (default "CRC", otherwise integer)
)
print(s.s)              # codex32 string

# Parse an existing codex32 string and inspect parts
a = Codex32String("ms13casha320zyxwvutsrqpnmlkjhgfedca2a8d0zehn8a0t")
print(a.hrp)            # human-readable part
print(a.k)              # threshold parameter
print(a.ident)          # 4 character identifier
print(a.share_idx)      # share index character
print(a.payload)        # payload part
print(a.checksum)       # checksum part
print(len(a))           # length of the codex32 string
print(a.is_upper)       # case is upper True/False
print(s.data.hex())     # raw seed bytes as hex
print(a.pad_val)        # padding value integer, (MSB first)



# Create from unchecksummed string (will append checksum)
c = Codex32String.from_unchecksummed_string("ms13cashcacdefghjklmnpqrstuvwxyz023")
print(str(c))           # equivalent to print(c.s)

# Interpolate shares to recover or derive target share index
shares = [s, a, c]
derived_share_d = Codex32String.interpolate_at(shares, target='d')
print(derived_share_d.s)

# Create Codex32String object from existing codex32 string and validate any HRP
e = Codex32String.from_string("cl", "cl10lueasd35kw6r5de5kueedxyesqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqanvrktzhlhusz")
print(e.ident)
print(e.s)

# Relabel a Codex32String object
e.ident = "cln2"
print(e.ident)
print(e.s)

# Uppercase a Codex32String object (for encoding in QR codes or handwriting)
e.is_upper = True
print(e.s)

Tests

pip install -e .[dev]
pytest

Release files for codex32 0.6.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 codex32 0.6.1
File Size Uploaded
codex32-0.6.1.tar.gz 27.9 kB Details

Built distribution (wheel)

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

Total release size: 42.8 kB

Release files / codex32-0.6.1.tar.gz

Download URL codex32-0.6.1.tar.gz
Size 27.9 kB
Tags Source
SHA-256 checksum
How to use checksums
57e2645e4eab870f59500217de44d8ba1f059d6b78ae6daf96705a0c31679871
BLAKE2b-256 checksum
How to use checksums
2ac61a7893241e236003fad8049d9421a41d0f0ed0629c5174cd14a82e548835
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jan 21, 2026.

Transparency log

Release files / codex32-0.6.1-py3-none-any.whl

Download URL codex32-0.6.1-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aeeed3c0be7aa95c360d19c1f29e48e49cf70ee9573a578d4f9b1ac19b1a13fb
BLAKE2b-256 checksum
How to use checksums
3b9a145d385da3bb5b71fed1e2c339fc71530b3c587b3a39a35a41c58d2d17f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jan 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

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