From 246f239d9f40f633160f0c18f87a20922d4e77bb Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:06:37 +0200 Subject: Merging debian version 1.65.0+dfsg1-2. Signed-off-by: Daniel Baumann --- vendor/sha-1-0.8.2/examples/sha1sum.rs | 49 ---------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 vendor/sha-1-0.8.2/examples/sha1sum.rs (limited to 'vendor/sha-1-0.8.2/examples/sha1sum.rs') diff --git a/vendor/sha-1-0.8.2/examples/sha1sum.rs b/vendor/sha-1-0.8.2/examples/sha1sum.rs deleted file mode 100644 index bde1ab4f6..000000000 --- a/vendor/sha-1-0.8.2/examples/sha1sum.rs +++ /dev/null @@ -1,49 +0,0 @@ -extern crate sha1; - -use sha1::{Sha1, Digest}; -use std::env; -use std::fs; -use std::io::{self, Read}; - -const BUFFER_SIZE: usize = 1024; - -/// Print digest result as hex string and name pair -fn print_result(sum: &[u8], name: &str) { - for byte in sum { - print!("{:02x}", byte); - } - println!("\t{}", name); -} - -/// Compute digest value for given `Reader` and print it -/// On any error simply return without doing anything -fn process(reader: &mut R, name: &str) { - let mut sh = D::default(); - let mut buffer = [0u8; BUFFER_SIZE]; - loop { - let n = match reader.read(&mut buffer) { - Ok(n) => n, - Err(_) => return, - }; - sh.input(&buffer[..n]); - if n == 0 || n < BUFFER_SIZE { - break; - } - } - print_result(&sh.result(), name); -} - -fn main() { - let args = env::args(); - // Process files listed in command line arguments one by one - // If no files provided process input from stdin - if args.len() > 1 { - for path in args.skip(1) { - if let Ok(mut file) = fs::File::open(&path) { - process::(&mut file, &path); - } - } - } else { - process::(&mut io::stdin(), "-"); - } -} -- cgit v1.2.3