Skip to main content

An implementation of Crockford's Base32 encoding for resource identifiers

Project description

Description

An implementation of Crockford's Base32 encoding, including checksums. Intended for use on unique resource identifiers in APIs. Does not apply automatic conversions on decode input as described in "API Design Patterns" by JJ Geewax p.92.

Created using pybind11 and setuptools.

Usage

encode(string input [, checksum = False])

import crockford32 as cr32

encode_input_one = "Hello"
encode_input_two = "Tree"

a = cr32.encode(encode_input_one)

b = cr32.encode(encode_input_two, True)

decode(string input [, checksum = False])

throws ValueError - invalid input characters

throws ValueError - invalid checksum (requires checksum=True)

import crockford32 as cr32

decode_input_one = "91JPRV3F"
decode_input_two = "AHS6AS8U"

try:
	a = cr32.decode(decode_input_one)
except ValueError:
	pass    

try:
	b = cr32.decode(decode_input_two, True)
except ValueError:
	pass    

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

crockford32-1.0.2-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (89.1 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.12+ x86-64

Supported by

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