masterthesis/codes/md5-dist/src/main.rs_all_ips_bak

22 lines
534 B
Plaintext
Raw Normal View History

2022-03-29 20:37:56 +02:00
use md5::{Digest, Md5};
use std::{
fs::File,
io::{BufWriter, Write},
};
fn main() -> std::io::Result<()> {
let file = File::create("./hashes.txt")?;
let mut writer = BufWriter::new(file);
for i in 0u32..=std::u32::MAX {
let mut hasher = Md5::new();
// let mut out = [0; 16];
hasher.update(i.to_le_bytes());
let out = hasher.finalize();
writeln!(writer, "{:02x}", out[out.len() - 1])?;
if i % 100_000 == 0 {
println!("{i}");
}
}
Ok(())
}