Base 2048

When Base 64 is not enough
Allows up to 11 bits of data per unicode character as counted by social media and chat platforms such as Twitter and Discord.
Uses a limited charset within the Basic Multilingual Plane.
Based on, and uses a compatible encoding table with the Rust crate rust-base2048.
- Charset displayable on most locales and platforms
- No control sequences, punctuation, quotes, or RTL characters
Getting Started
pip install base2048
import base2048
base2048.encode(b'Hello!')
# => 'ϓțƘ໐µ'
base2048.decode('ϓțƘ໐µ')
# => b'Hello!'
Up to 2x less counted characters compared to Base 64
import zlib
import base64
import base2048
string = ('🐍 🦀' * 1000 + '🐕' * 1000).encode()
data = zlib.compress(string)
b64_data = base64.b64encode(data)
# => b'eJztxrEJACAQBLBVHNUFBBvr75zvRvgxBEkRSGqvkbozIiIiIiIiIiIiIiIiIiIiIiJf5wAAAABvNbM+EOk='
len(b64_data)
# => 84
b2048_data = base2048.encode(data)
# => 'ը྿Ԧҩ২ŀΏਬйཬΙāಽႩԷ࿋ႬॴŒǔ०яχσǑňॷβǑňॷβǑňॷβǯၰØØÀձӿօĴ༎'
len(b2048_data)
# => 46
unpacked = zlib.decompress(base2048.decode(b2048_data)).decode()
len(unpacked)
# => 4000
unpacked[2000:2002]
# => '🦀🐍'
Decode errors are provided with a character-position of failure
----> base2048.decode('༗ǥԢΝĒϧǰ༎ǥ')
DecodeError: Unexpected character 8: ['ǥ'] after termination sequence 7: ['༎']
- To catch the error, use either
base2048.DecodeErroror its base exception,ValueError.
import base2048
try:
base2048.decode('🤔')
except base2048.DecodeError as e:
print(e)
License
The code in this project is released under the MIT License.
Related and prior works
Javascript - base2048
Rust - rust-base2048
Metadata
Release files for base2048 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| base2048-0.1.3.tar.gz | 91.4 kB | Without provenance | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| base2048-0.1.3-cp37-abi3-win_amd64.whl | CPython 3.7 | abi3 | Windows x86-64 | Details |
| base2048-0.1.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.7 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| base2048-0.1.3-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl | CPython 3.7 | abi3 | macOS 11.0+ ARM64, macOS 10.9+ universal2 (ARM64, x86-64), macOS 10.9+ x86-64 | Details |
Total release size: 1.7 MB
Release files / base2048-0.1.3.tar.gz
| Download URL | base2048-0.1.3.tar.gz |
|---|---|
| Size | 91.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51d9eeae723b8aa84d9721211ca3b62a20cb2b884efbf53b61b3c3a7c440969d
|
|
BLAKE2b-256 checksum How to use checksums |
00a52c630c47316f6bf0a2a0fc920f7b09f012bb53ee20baac6172ec3a030cdc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.13.3
|
Release files / base2048-0.1.3-cp37-abi3-win_amd64.whl
| Download URL | base2048-0.1.3-cp37-abi3-win_amd64.whl |
|---|---|
| Size | 122.9 kB |
| Tags | CPython 3.7 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d1aefd5ee3bee6a6999e38fc01e6ec9cf788d72a5df28b54d8656e51b4a24a9b
|
|
BLAKE2b-256 checksum How to use checksums |
346fe234bd2c89d714340a8389ebd2e313b30d87eef6cadebe12d852c671662a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.13.3
|
Release files / base2048-0.1.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | base2048-0.1.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.7 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ad23081619ae06cd7de156252303a865e571bf0527f18272bedaad0f9d431164
|
|
BLAKE2b-256 checksum How to use checksums |
448c1a3e859adbe3ae8f3d7c589abfd5983bd3d707b6197c369eb8e56a25cedd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.13.3
|
Release files / base2048-0.1.3-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
| Download URL | base2048-0.1.3-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl |
|---|---|
| Size | 448.2 kB |
| Tags | CPython 3.7 abi3 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a99289d9594300e55f04fa95a009f24d25d101160818c0be13e56edd9e4ca5c5
|
|
BLAKE2b-256 checksum How to use checksums |
38be47723c2a1cf051c2f302be4dd42f847cf50fb7141569aedf8ae834e06a10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.13.3
|
Security for base2048 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.