base256
Dense byte-to-unicode encoding. 32 bytes → 32 characters.
// Before: Debug output for [u8; 32]
// After: base256 encoding
ЩóΓÎLÄμöÊLχ9ρÞ4ωÒmiЁBøάЩηÄθÓψÏÇΔa
Install
Library:
CLI:
Use
Library:
use Base256;
// Basic encoding/decoding
let key = ;
let encoded = encode; // 111111111111111111111111111111111
let decoded = decode.unwrap;
// String parsing (new in 0.4.0)
let valid = is_valid;
let bytes = parse.unwrap;
// Hex conversions
let hex_bytes = to_hex.unwrap; // [48, 48, 48, ...] (64 bytes)
let from_hex = from_hex.unwrap; // back to base256
// Direct byte-hex conversions
let hex = bytes_to_hex; // "0000...0000" as bytes
let bytes = hex_to_bytes.unwrap;
CLI:
# Encode stdin to base256 (default)
|
# Decode base256 to raw bytes
| |
# Encode to hex
|
# Convert hex to base256
|
# Convert base256 to hex
|
# SSH public key to base256
| | |
Design
- true 1:1 mapping: 32 bytes → 32 characters (always)
- shell-safe: Base58 core avoids ALL shell metacharacters
- no-std: Zero dependencies, zero allocations
- type-safe: Use
[char; 32]arrays, not variable-length strings
Character set (256 total):
- Base58 alphabet (58) - proven shell-safe
- Latin-1 letters (68) - no symbols
- Greek alphabet (64) - full set
- Cyrillic letters (66) - Russian alphabet
When to use
Use base256 for:
- Ed25519/Curve25519 public keys
- SHA-256 hashes in terminal output
- Any 32-byte value displayed to humans
Use hex for:
- Maximum compatibility
- Machine-to-machine protocols
- Debugging binary data
Examples
# Generate ed25519 public key identifier
| \
| \
| \
# Output: sοΤQÞвύώБρÄUÁπΨQΞeRϊyϏjϋнХÀēāÄnт
# Compare all encodings
KEY=
| | |
License
MIT OR Apache-2.0