#[macro_use] extern crate log; extern crate env_logger; extern crate rustc_serialize; use rustc_serialize::hex::{FromHex, ToHex}; use std::io::{BufRead, stdin}; struct Pairwise(T); impl Iterator for Pairwise where T: Iterator { type Item = (T::Item, T::Item); fn next(&mut self) -> Option { if let (Some(fst), Some(snd)) = (self.0.next(), self.0.next()) { Some((fst, snd)) } else { None } } } fn main() { env_logger::init().unwrap(); let stdin = stdin(); for (line1, line2) in Pairwise(stdin.lock().lines().filter_map(|x| x.ok())) { match (line1.from_hex(), line2.from_hex()) { (Ok(v1), Ok(v2)) => println!("{}", v1.iter().zip(v2).map(|(a, b)| a ^ b).collect::>().to_hex()), (Err(e), _) => error!("{}", e), (_, Err(e)) => error!("{}", e) } } }