qr-base44
Base44 encoder/decoder for arbitrary bytes using a URL-safe QR-compatible alphabet.
- Encoding scheme: 2 bytes -> 3 chars; 1 byte -> 2 chars
- Alphabet:
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$%*+-./:(44 characters) - URL-safe: excludes space from Base45 (RFC 9285)
- Public API: byte-oriented operations, no string reinterpretation
Usage
use ;
let data: & = &;
let s = encode;
let back = decode.unwrap;
assert_eq!;
Features
- URL-safe: Unlike Base45, Base44 removes the space character which can cause issues in URLs
- QR-compatible: Uses a subset of QR Code alphanumeric mode characters
- Efficient: Compact binary encoding with ~1.5x size overhead
- Error handling: Validates input and reports invalid characters, dangling groups, and overflow
Notes
- MSRV: 1.85+ (Rust 2024 edition requirement)
- This crate intentionally encodes/decodes arbitrary bytes, not UTF-8 text. If you have a text string, pass its bytes explicitly.
- Error types include: invalid characters, dangling final character, and numeric overflow.
- Compared to Base45, Base44 is more suitable for use in URLs and QR codes by removing the space character.
Documentation
License
Apache-2.0