use std::io::Read; use algorithms::crc::Crc; fn main() { let args: Vec = std::env::args().collect(); let use_ffi = args.contains(&"-c".to_string()); let mut input = Vec::new(); std::io::stdin() .read_to_end(&mut input) .expect("could not read from stdin"); let crc = if use_ffi { algorithms::crc::ffi::Crc32::checksum(&input) } else { algorithms::crc::Crc32::checksum(&input) }; println!("{crc:08x}"); }