yencoding
yEnc encoding and decoding for Usenet binary posts.
yEnc (2001) replaced UUencode and Base64 on Usenet by passing most bytes through with only a +42 offset, giving ~1–2% overhead instead of 33%. This crate provides a pure-Rust, no-filesystem, no-unsafe implementation.
Features
decode(input)— decode a yEnc article from raw bytes, with CRC32 verificationencode(data, filename, line_length)— encode bytes as a single-part articleencode_part(...)— encode one part of a multi-part series- Handles preamble text before
=ybegin(NNTP article headers, etc.) - Accepts both LF and CRLF line endings
- Handles NNTP dot-stuffing
total_partsexposed onYencMetadatafor multi-part reassembly- No filesystem I/O — all operations on
&[u8]/Vec<u8> - No unsafe code
- MSRV: 1.75
Usage
use ;
// Decode a yEnc article (preamble/NNTP headers are skipped automatically)
let article: & = b"=ybegin line=128 size=3 name=hi.bin\r\n},-\r\n=yend size=3 crc32=b63cfbcd\r\n";
let part = decode.unwrap;
assert_eq!;
assert_eq!;
assert!;
// Encode bytes as a single-part article
let encoded = encode;
assert!;
Multi-part articles
For multi-part Usenet posts, decode each article individually with decode(),
then reassemble using the companion
yencoding-multi crate.
DecodedPart::metadata.total_parts and part_begin/part_end carry the
information needed for reassembly without separately parsing subject lines.
Error types
Security
Decoded bytes may represent a compressed archive. Any decompression is the caller's responsibility and must be independently guarded against decompression-bomb attacks. This crate does not decompress.
License
MIT OR Apache-2.0