Add codes for MD5(IP) distribution

This commit is contained in:
Valentin Brandl
2022-03-29 20:37:56 +02:00
parent acee05a161
commit d1d76a2dba
11 changed files with 689 additions and 0 deletions

View File

@ -0,0 +1,21 @@
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(())
}