123456789101112131415161718192021 |
- extern crate crypto_hash;
- extern crate memmap;
- extern crate rayon;
- use crypto_hash::{hex_digest, Algorithm};
- use memmap::MmapOptions;
- use rayon::prelude::*;
- use std::fs::File;
- pub fn rainbow(infile: &File, quiet: bool) {
- let mmap = unsafe { MmapOptions::new().map(&infile).unwrap() };
- mmap.par_split(|c| *c == '\n' as u8)
- .map(|coso| {
- let hash = hex_digest(Algorithm::MD5, coso);
- if !quiet {
- println!("{}", hash);
- }
- })
- .collect::<()>();
- }
|