lib.rs 506 B

1234567891011121314151617181920
  1. extern crate crypto_hash;
  2. extern crate rayon;
  3. extern crate memmap;
  4. use crypto_hash::{Algorithm, hex_digest};
  5. use std::fs::File;
  6. use memmap::MmapOptions;
  7. use rayon::prelude::*;
  8. pub fn rainbow(file: &str) {
  9. let file = File::open(file).unwrap();
  10. let mmap = unsafe { MmapOptions::new().map(&file).unwrap() };
  11. mmap.par_split(|c| *c == '\n' as u8)
  12. .map(|coso| {
  13. let _hash = hex_digest(Algorithm::MD5, coso);
  14. // println!("{}", _hash);
  15. }).collect::<()>();
  16. }