Base32 encoding/decoding, RFC4648, RFC4648_HEX, Crockford
Project description
base32_tiny
A pure python lib for base32 encoding/decoding, RFC3548, RFC4648, RFC4648_HEX, Crockford
Installation
using pip
$ pip install base32_tiny
using poetry
$ poetry add base32_tiny
Usage
from base32_tiny import decode, encode
content = "hello, there!"
#content_bytes = b"hello, there!"
result_rfc3548 = encode(content, variant="RFC3548")
print(result_rfc3548) # output: NBSWY3DPFQQHI2DFOJSSC===
print(decode(result_rfc3548, variant="RFC3548").decode("utf-8") == content) # output: True
result_rfc4648 = encode(content, variant="RFC4648")
print(result_rfc4648) # output: NBSWY3DPFQQHI2DFOJSSC===
print(decode(result_rfc4648, variant="RFC4648")) # output: b'hello, there!'
result_rfc4648_HEX = encode(content, variant="RFC4648-HEX")
print(result_rfc4648_HEX) # output: D1IMOR3F5GG78Q35E9II2===
print(decode(result_rfc4648_HEX, variant="RFC4648-HEX")) # output: b'hello, there!'
result_crockford = encode(content, variant="Crockford")
print(result_crockford) # output: D1JPRV3F5GG78T35E9JJ2
print(decode(result_crockford, variant="Crockford")) # output: b'hello, there!'
API Reference
def encode(data: Union[str, bytes], *, variant: Variant, options: Optional[Options] = None) -> str
def decode(input_str: str, variant: Variant) -> bytes
from typing import TypedDict, Literal
class Options(TypedDict, total=False):
padding: bool
Variant = Literal["RFC3548", "RFC4648", "RFC4648-HEX", "Crockford"]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
base32_tiny-0.1.3.tar.gz
(2.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file base32_tiny-0.1.3.tar.gz.
File metadata
- Download URL: base32_tiny-0.1.3.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fc59c65e5a632dffa7b238164f9cd0daae9791211ea8eff93d97f175053190d
|
|
| MD5 |
1692257ad460c6bb81746ee732d81c76
|
|
| BLAKE2b-256 |
966a8325ba3ea72ad94da88db1007372e18602e68d9fa14ca54de17c4523d803
|
File details
Details for the file base32_tiny-0.1.3-py3-none-any.whl.
File metadata
- Download URL: base32_tiny-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
553166ff2fd5a44a6cbeea08a98fa4acee40401b5e4e4fe78ff6d3e5f9f645a5
|
|
| MD5 |
42a87014ccf81036526b7ce119addf86
|
|
| BLAKE2b-256 |
7b2d453bad4cb8c14d9e5f7c168e2e6a71df597526b16e2721f6bbc4025512e0
|