7 releases
Uses new Rust 2024
| new 0.3.1 | Oct 16, 2025 |
|---|---|
| 0.3.0 | Oct 4, 2025 |
| 0.2.2 | Oct 4, 2025 |
| 0.2.1 | Sep 26, 2025 |
| 0.1.1 | Sep 25, 2025 |
#2143 in Encoding
590 downloads per month
8KB
145 lines
basic64
A straightforward implementation of base64 in Rust.
lib.rs:
Usage
use std::io::{self, Read};
use basic64;
fn main() {
let mut handle = io::stdin().lock();
let mut input = [0u8; basic64::round_len!(dec 8_192)];
// !
let mut encoded = String::with_capacity(basic64::needed_len!(enc input.len()));
while let Ok(n) = handle.read(&mut input) {
if n == 0 {
break;
}
// !
basic64::encode_into(&input[..n], &mut encoded);
print!("{}", encoded);
encoded.clear();
}
println!("");
}