Base32 encoding/decoding, RFC4648, RFC4648_HEX, Crockford
Project description
base32_tiny
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.decode import decode
from base32_tiny.encode import 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.1.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.1.tar.gz.
File metadata
- Download URL: base32_tiny-0.1.1.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78ba9af7b305be19e2477c6899d644a574e72b693310bb0d608725d2eb488802
|
|
| MD5 |
a3c9f339abd63a070eb314bd297eb7ec
|
|
| BLAKE2b-256 |
883a538ebec1bad6c4c89522d737c3b8a577514c859224acf1db8fce660dc0eb
|
File details
Details for the file base32_tiny-0.1.1-py3-none-any.whl.
File metadata
- Download URL: base32_tiny-0.1.1-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.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71e1d14d6ddbb2fe7f6d1f79aa72c963807be90813ff3ae4abd2c2036cc1d2e5
|
|
| MD5 |
91bdd461353261450b050b97605a72b4
|
|
| BLAKE2b-256 |
31f3e1259571aa770e46044a239e622b9841bab37b5c8290cc2ad41a2b4144a7
|