Skip to main content

Ultra-fast Base64 encoding/decoding library with SIMD and multithreading support

Project description

UltraBase64

Ultra-fast Base64 encoding/decoding library with SIMD and multithreading support, written in Rust for Python.

Features

  • Blazing Fast: Utilizes SIMD instructions (AVX2/SSE/NEON) for maximum performance
  • Multithreaded: Automatic multithreading for large data sets
  • Memory Efficient: Zero-copy operations where possible
  • Cross-Platform: Works on Linux, Windows, and macOS
  • Easy to Use: Simple Python API

Installation

pip install ultrabase64

Usage

import ultrabase64

# Basic encoding/decoding
data = b"Hello, World!"
encoded = ultrabase64.encode(data)
decoded = ultrabase64.decode(encoded)

print(f"Original: {data}")
print(f"Encoded: {encoded}")
print(f"Decoded: {decoded}")

# Encoding with specific number of threads
large_data = b"x" * 1000000
encoded_threaded = ultrabase64.encode_with_threads(large_data, threads=4)

Performance

UltraBase64 automatically chooses the optimal strategy:

  • Small data (< 256KB): Single-threaded with SIMD optimizations
  • Large data (>= 256KB): Multi-threaded processing using all available CPU cores
  • Custom threading: Use encode_with_threads() for manual control

API Reference

encode(data: bytes) -> str

Encodes bytes to Base64 string with automatic optimization.

decode(data: str) -> bytes

Decodes Base64 string to bytes.

encode_with_threads(data: bytes, threads: int) -> str

Encodes bytes to Base64 string using specified number of threads.

Building from Source

Requirements:

  • Python 3.8+
  • Rust toolchain
  • maturin
git clone https://github.com/yourusername/ultrabase64
cd ultrabase64
maturin develop --release

License

This project is licensed under either of

  • Apache License, Version 2.0
  • MIT license

at your option.

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

ultrabase64-1.0.0.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

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

ultrabase64-1.0.0-cp312-cp312-manylinux_2_34_x86_64.whl (244.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

File details

Details for the file ultrabase64-1.0.0.tar.gz.

File metadata

  • Download URL: ultrabase64-1.0.0.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.7

File hashes

Hashes for ultrabase64-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3bb32024a5834ff5190f15d62eb27e1ccf7425496c4500defd5183ea385ea246
MD5 ef6dad613f2454ca59d9d6a98724842e
BLAKE2b-256 850520c182ed5fa0e5f28a1c520c940df4c76fc60f23e66c9e7c41a8de6bd899

See more details on using hashes here.

File details

Details for the file ultrabase64-1.0.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ultrabase64-1.0.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 705e0d070270b57e6f7c2d2ce6d1c2bea67ed503ba7a11a3fbbf259e5cd0e815
MD5 17d81690d9367a93054b70db2f30ce7f
BLAKE2b-256 d046a265870db5e65cfacfc766b2ea3c76b04f082b63ca69bf2cc8ab31d259bd

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