base256
Dense byte-to-unicode encoding. Maps 256 bytes to 256 distinct unicode characters.
What is base256
A compact encoding scheme for 32-byte values (keys, hashes) that:
- Produces exactly 32 unicode characters from 32 bytes
- Uses visually distinct characters
- Survives copy/paste across platforms
- Works in terminals and monospace fonts
What base256 is not
- Not base64 (which expands data by 33%)
- Not for arbitrary-length data (fixed 32-byte arrays only)
- Not for cryptographic security (just encoding)
- Not latex-compatible (uses unicode blocks)
Installation
Library usage
use Base256;
let key = ;
let encoded = encode; // [char; 32]
let decoded = decode.unwrap;
assert_eq!;
Command-line usage
Install the CLI:
Use base256:
# encode 32 bytes from stdin
|
# decode back to binary
| |
# round-trip
| | |
# help
Character set
- ASCII printables (95)
- Latin-1 supplement (95)
- Greek lowercase (25)
- Cyrillic subset (25)
- Math symbols (16)
Total: 256 unique characters optimized for visual distinction and font support.
Use cases
When to use base256
- Displaying cryptographic keys in terminals
- Compact representation of 32-byte identifiers
- Copy-pasteable binary data that needs to stay compact
- Ed25519 public keys, SHA-256 hashes
When not to use base256
- Variable-length data
- Systems requiring base64 compatibility
- Documents requiring ASCII-only encoding
- Data that might be processed by legacy systems
License
MIT OR Apache-2.0