base32-lib
Small library to generate, encode and decode random base32 strings with nice properties.
Usage
import base32_lib as base32
# Generate
## Generate a random identifier
base32.generate()
# -> 'abcd1234'
# Generate a random identifier with bells and whistle
base32.generate(length=10, split_every=5, checksum=True)
# -> '3sbk2-5j060'
# Encode a pre-existing number
base32.encode(1234, split_every=3, checksum=True) == "16j-82"
# Decode an identifier
base32.decode("16j-82", checksum=True) == 1234
base32.decode("16i-82", checksum=True)
# raises ValueError
Features
Generation, encoding and decoding of base32 strings
Douglas Crockford base32 encoding
URL-safe strings with no problematic special characters
Decoding of any-case strings
Configurable length strings
Randomness through cryptographically secure random number generator
Optional ISO-7064 checksum
Optional hyphenation
Installation
The base32-lib package is on PyPI so all you need is:
pip install base32-lib
Development
pipenv run pip install -e .[docs,tests]
Tests
pipenv run ./run-tests.sh
Changes
Version 1.0.0 (2019-10-XX)
First public release.
Metadata
Release files for base32-lib 1.0.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 | |
|---|---|---|---|
| base32-lib-1.0.0.tar.gz | 12.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| base32_lib-1.0.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 19.5 kB
Release files / base32-lib-1.0.0.tar.gz
| Download URL | base32-lib-1.0.0.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8291dc980895b9ee911d0b0100c251a9101b0ebb6e7d8299161077bb6b48a22c
|
|
BLAKE2b-256 checksum How to use checksums |
34ea5e039549935bcece320c45057a42ec815d01ff16d0423e2c4f1e2f192484
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.6.7
|
Release files / base32_lib-1.0.0-py2.py3-none-any.whl
| Download URL | base32_lib-1.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
f6631026f2074da326654a9384a0232ae654f14a47cfeb08a2287b17fe0ff374
|
|
BLAKE2b-256 checksum How to use checksums |
c787312571718fe59b91cf9dac8640747a6b26a4a23bab089e0cbcfb5cf7ffda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.6.7
|