21 lines
486 B
Rust
21 lines
486 B
Rust
#[macro_use]
|
|
extern crate log;
|
|
extern crate env_logger;
|
|
extern crate rustc_serialize;
|
|
|
|
use rustc_serialize::hex::FromHex;
|
|
use rustc_serialize::base64::{STANDARD, ToBase64};
|
|
use std::io::{BufRead, stdin};
|
|
|
|
fn main() {
|
|
env_logger::init().unwrap();
|
|
let stdin = stdin();
|
|
|
|
for line in stdin.lock().lines().filter_map(|x| x.ok()) {
|
|
match line.from_hex() {
|
|
Ok(v) => println!("{}", v.to_base64(STANDARD)),
|
|
Err(e) => error!("{}", e)
|
|
}
|
|
}
|
|
}
|