uuencoding
UUencoding and UUdecoding for Rust — encode, decode, and scan for UU blocks.
UUencoding is a binary-to-text encoding from the UUCP/Usenet era (1980s). It appears
in email as Content-Transfer-Encoding: x-uuencode and as inline begin/end blocks
embedded in text/plain message bodies.
Features
encode(data, filename, mode)— produce a well-formedbegin/endUU blockdecode(input)— decode a full UU block includingbegin/endframingscan(input)— find all UU blocks by byte offset in arbitrary text (inline use case)- Handles real-world noise: CRLF line endings, trailing-space stripping by mail relays,
space/backtick ambiguity for zero, missing
endlines,begin-base64detection - No panics on any input
- No unsafe code
- MSRV: 1.75
Usage
use ;
// Encode
let encoded = encode;
// Decode
let block = decode.unwrap;
assert_eq!;
assert_eq!;
// Scan for inline blocks
for result in scan
Security
Decoded output can be significantly larger than encoded input. If the decoded bytes are a compressed archive, any decompression is the caller's responsibility and must be independently guarded against decompression bombs.
License
MIT OR Apache-2.0