Skip to main content

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 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.2.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

base32_tiny-0.1.2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file base32_tiny-0.1.2.tar.gz.

File metadata

  • Download URL: base32_tiny-0.1.2.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

Hashes for base32_tiny-0.1.2.tar.gz
Algorithm Hash digest
SHA256 72a14db3078c2eea97fface9069d5f6cb6534ef5bf2d40a9b0ea2d3c0338b053
MD5 3c8948551d893b5c595c3fdfe1e2ffd9
BLAKE2b-256 0670f204cf7581ee589bcbb2ed61593e67b8684f85850ad3987e444ec7ea0637

See more details on using hashes here.

File details

Details for the file base32_tiny-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: base32_tiny-0.1.2-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

Hashes for base32_tiny-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 13b2b62ccd387b53436f31dbc89658c48f67a60b830046d2813cfb218b5b95d7
MD5 0b1145c18d4fd6e4e09b3e50860edb16
BLAKE2b-256 3ffa2c2e9c3c9d76084cd6dc5c5c335e6c989c9a0ec5ec232f9c3af1f1063426

See more details on using hashes here.

Supported by

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