Initial commit.

This commit is contained in:
Olivia Brooks
2025-11-23 10:18:59 -05:00
commit 0a2c93748d
4 changed files with 299 additions and 0 deletions

65
src/main.rs Normal file
View File

@@ -0,0 +1,65 @@
use std::thread;
use hex_literal;
use md2::{Digest, Md2};
const CHAR_SET: &[u8] =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ&.<(+|-!$*);/,%_>?:#'0=\"@~".as_bytes();
const MAX_LEN: usize = CHAR_SET.len();
const TARGET: [u8; 16] = hex_literal::hex!("e809236d4b94e54174e666cf3b1f53ce");
const KNOWN: &str = "CYBERSCI(PUNCH?C4RD?1S?7H3?FL4SH?ST0RAGE?OF?";
fn main() {
let mut hasher = Md2::new();
hasher.update(KNOWN);
let mut handles = vec![];
for idx in 0..MAX_LEN {
handles.push(thread::spawn(move || {
brute(CHAR_SET[idx.clone()]);
}));
}
for h in handles {
h.join().unwrap();
}
}
fn brute(start_val: u8) {
let mut hasher = Md2::new();
hasher.update(KNOWN);
let mut result = hasher.finalize_reset();
let mut a: usize = 0;
let mut b: usize = 0;
let mut c: usize = 0;
let mut guess = String::new();
while result[..] != TARGET {
if a == (MAX_LEN - 1) {
a = 0;
b += 1;
} else {
a += 1;
}
if b == MAX_LEN {
b = 0;
c += 1;
}
if c == MAX_LEN {
return ();
}
guess = format!(
"{}{}{}{}{})",
KNOWN, &start_val, CHAR_SET[c], CHAR_SET[b], CHAR_SET[a],
);
hasher.update(&guess);
result = hasher.finalize_reset();
}
println!("{}", guess);
}