base-d

Turns bytes into anything. Playing cards, hieroglyphs, emoji, RFC base64 — same engine, your choice of alphabet.
Why base-d?
You probably have base64, sha256sum, crc32 as separate tools. base-d does all of it:
- Encode with 45+ dictionaries (or define your own)
- Hash with 26 algorithms — SHA-256, BLAKE3, CRC32, xxHash3
- Compress with gzip, zstd, brotli, lz4, snappy, lzma
- Stream multi-GB files with constant 4KB memory
- Detect which encoding was used automatically
One tool. SIMD-accelerated. 7.4 GiB/s decode, 500 MiB/s encode.
Pick your path
Want to mess around?
Wake up, Neo...
Want the CLI? → CLI Quick Start | Full CLI docs
Want the library? → Library Quick Start | Full API docs
CLI Quick Start
# Encode with playing cards (default dictionary)
|
# 🂡🂢🂣🂤🂥🂦
# RFC base64
|
# aGVsbG8=
# Hieroglyphics, because why not
|
# Word-based encoding (BIP-39 seed phrases)
|
# abandon absorb morning...
# Hash a file
# Compress + encode in one shot
# Auto-detect and decode
|
Library Quick Start
use ;
// Basic encoding
let registry = with_builtins;
let dict = registry.get.unwrap;
let encoded = encode;
let decoded = decode?;
// Streaming for large data
use ;
let mut encoder = new;
encoder.update?;
encoder.update?;
let result = encoder.finalize?;
How it works
The core idea
base-d is a universal encoder. It converts bytes into symbols using dictionaries — lookup tables that map values to characters. The dictionary is the only thing that changes between "serious RFC base64" and "playing cards."
bytes → [dictionary] → symbols
Three encoding modes
| Mode | How it works | Best for |
|---|---|---|
| Mathematical | Treats data as one big number, converts to target base | Any dictionary size, compact output |
| Chunked | RFC 4648 style, processes fixed bit groups | Standards compliance (base64, base32) |
| Byte Range | 1:1 byte-to-symbol mapping | base256, emoji, visual encodings |
Dictionaries
45+ built-in dictionaries organized by encoding type:
dictionaries/
├── word/ # Whole words as symbols (BIP-39, Pokemon, NATO...)
├── chunked/ # RFC 4648 style (base64, base32, base16...)
├── byterange/ # 1:1 byte mapping (base100, weather symbols)
└── radix/ # Mathematical conversion (cards, hieroglyphs, emoji...)
| Encoding | Examples |
|---|---|
| word/ | bip39, diceware, eff-long, pgp, nato, pokemon, klingon |
| chunked/ | base64, base32, base16, base256-matrix, boxdraw |
| byterange/ | base100, weather |
| radix/ | cards, hieroglyphs, chess, emoji, base58, base85 |
Browse the dictionaries/ folder to explore — the structure teaches you what the tool can do.
Full dictionary list → | Create your own →
Performance
SIMD-accelerated with runtime detection:
- x86_64: AVX2, SSSE3 with specialized RFC dictionary paths
- ARM: NEON with equivalent optimizations
- Fallback: Portable LUT-based implementation
| Operation | Throughput |
|---|---|
| base64 decode (AVX2) | 7.4 GiB/s |
| base64 encode (AVX2) | 500 MiB/s |
| Arbitrary dictionary | 50-200 MiB/s |
SIMD internals → | Benchmarks →
Schema encoding (fiche)
Structured data encoding that preserves type information:
|
# Compact binary with recoverable structure
# {"name": "Neo", "age": 30}
Documentation
| Topic | Description |
|---|---|
| API Reference | Library usage, examples, types |
| CLI Reference | Commands, flags, workflows |
| Encoding Modes | Mathematical vs chunked vs byte-range |
| Dictionaries | Built-in dictionaries reference |
| Custom Dictionaries | Define your own alphabets |
| Compression | Compress-then-encode pipeline |
| Hashing | 26 hash algorithms |
| Streaming | Memory-efficient large file processing |
| SIMD | Performance internals |
| Schema/Fiche | Structured data encoding |
| Detection | Auto-detect encoding format |
| Neo Mode | The Matrix easter egg |
Install
# From crates.io
# From source
License
MIT OR Apache-2.0