Base64 encoding without Python's base64 flaws. No padding, str types.
Project description
URL-safe Base64 for Python
A simple module for encoding without padding, fixing Python standard library's flaws.
Replaces the standard library's base64.urlsafe_b64encode and base64.urlsafe_b64decode with a cleaner implementation that returns strings instead of bytes and avoids unnecessary padding.
Features
- URL safe: Uses only characters that are safe for URLs and filenames
- No padding: Removes trailing
=characters for cleaner output - String output: Returns proper strings instead of bytes (unlike Python's standard library)
- Fast: Based on Python stdlib, with constant-time padding restoration
Installation
pip install base64url
Or for your project using uv:
uv add base64url
Usage
import base64url
text = base64url.enc(bytes(4)) # Returns "AAAAAA"
data = base64url.dec(text) # Recovers the bytes
enc(data: bytes) -> str
Base64 encode bytes to a URL-safe string without padding.
dec(s: str) -> bytes
Decode URL-safe Base64 into bytes. Padding optional.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 base64url-1.0.0.tar.gz.
File metadata
- Download URL: base64url-1.0.0.tar.gz
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71da5cacfe4ea0871debe124658832e86a026383a7eb46377a0911cdc08ec3b7
|
|
| MD5 |
850e61065db6383e901647809bd52121
|
|
| BLAKE2b-256 |
f6d1779a5c5ec4a6c8e76aea9533f10b076aab7d0d101b64d145e87a8a76e713
|
File details
Details for the file base64url-1.0.0-py3-none-any.whl.
File metadata
- Download URL: base64url-1.0.0-py3-none-any.whl
- Upload date:
- Size: 2.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aac666e45c602817355366d557967f00a35a59481b7d42a82edb6aee9c42cb9
|
|
| MD5 |
380300d762486e4151d2ea2538bbeb56
|
|
| BLAKE2b-256 |
b995ca5aeb1a61b6227d601364ca31160d3b8ab28ab2377c7fcc970b915b19e3
|