Registry / auth-security / bech32m

bech32m

JSON →
library1.0.0pypypi✓ verified 80d ago

Python library for encoding and decoding Bech32 and Bech32m addresses (Bitcoin improvement BIP-350). Version 1.0.0 supports Python 3.9+ with a stable API based on BIP-0173 and BIP-0350. Release cadence is low; maintained on GitHub.

pip install bech32m
INSTALL
IMPORT
SIG · BECH32M
B
bech32m
auth-securitypythonv1.0.0
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

encode
from bech32m import encode
from bech32m import bech32_encode
decode
from bech32m import decode
DecodeError
from bech32m import DecodeError

Encode and decode a Bech32m address (BIP-350). The data argument is a list of 5-bit integers.

import os from bech32m import bech32_encode, bech32_decode hrp = "bc" # Convert bytes to 5-bit groups internally data = [0, 1, 2, 3, 4, 5] addr = bech32_encode(hrp, data) print("Encoded:", addr) # Decode hrp_got, data_got = bech32_decode(addr) print("Decoded HRP:", hrp_got) print("Decoded data:", data_got)
Debug
Known issues
breakingThe library bech32m is NOT the same as the old 'bech32' library. Import paths differ and APIs are not compatible.
fix
Use 'from bech32m import ...' instead of 'from bech32 import ...'. Uninstall 'bech32' if present.
affects: all
gotchaThe encoding functions expect data in 5-bit groups (integers 0-31). Passing raw bytes will silently produce incorrect addresses.
fix
Convert bytes to 5-bit groups using a conversion function (e.g., ods/bech32m provides a utility, but the main API does not include one; handle this externally).
affects: all
Upgrade
Version history
1.0.0latest on PyPI · released Jun 14, 2023
Audit
Dependencies
typing_extensionsoptionalUsed for type hints on Python <3.11
Agent activity
26 hits · last 30 days
node
22
OpenAI (training)
1
Resources
bech32m — pip install bech32m · libregistry