social-hash-brute/src/main.rs
2025-11-13 00:15:02 -05:00

45 lines
1.7 KiB
Rust

use std::{process, thread};
use hex_literal::hex;
use sha2::{Digest, Sha256};
const TARGET: [u8; 32] = hex!("5acd39e18f0b85b469e593a710883890a044f4548a098ff5ef14c159d17bc40e");
fn main() {
let threads: Vec<_> = (b'a'..=b'z')
.map(|a| {
thread::spawn(move || {
eprintln!("i am {}, and i have started", char::from(a));
for b in b'a'..=b'z' {
for c in b'a'..=b'z' {
for d in b'a'..=b'z' {
for e in b'a'..=b'z' {
for f in b'a'..=b'z' {
for g in b'a'..=b'z' {
let word = [a, b, c, d, e, f, g];
let mut hasher = Sha256::new();
hasher.update(b"social.");
hasher.update(word);
hasher.update(".space");
let digest = hasher.finalize();
if digest[..] == TARGET {
println!("{}", String::from_utf8_lossy(&word));
process::exit(0);
}
}
}
}
}
}
}
eprintln!("i am {}, and i have failed", char::from(a));
})
})
.collect();
for thread in threads {
thread.join().unwrap();
}
process::exit(1);
}