use std::io::Read; use algorithms::hash::format_digest; 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 hash = if use_ffi { algorithms::hash::ffi::sha2_256_oneshot(&input).expect("could not hash your input data") } else { algorithms::hash::sha2_256_oneshot(&input).expect("could not hash your input data") }; println!("{}", format_digest(&hash)); }