vibe coded a crc reverse engineer tool on gpu, because why not

This commit is contained in:
2026-04-12 23:05:19 +02:00
commit 973b4dba18
6 changed files with 881 additions and 0 deletions

52
src/main.rs Normal file
View File

@@ -0,0 +1,52 @@
mod cracker;
mod gpu;
use std::fs::File;
use std::io::BufWriter;
use cracker::{Constraints, TestCase, ValueRange};
use gpu::GpuCracker;
fn main() {
pollster::block_on(run());
}
async fn run() {
let cracker = GpuCracker::new().await;
let mut out = BufWriter::new(
File::create("results.txt").expect("cannot create results.txt"),
);
let count = cracker.run(
&[
TestCase::masked(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0x00], 0x94, 0x00FF),
TestCase::masked(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0x01], 0x61, 0x00FF),
TestCase::masked(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0x02], 0x8B, 0x00FF),
TestCase::masked(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0x03], 0x7E, 0x00FF),
TestCase::masked(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0x04], 0xAA, 0x00FF),
TestCase::masked(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0x05], 0x5F, 0x00FF),
TestCase::masked(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0x06], 0xB5, 0x00FF),
TestCase::masked(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0x07], 0x40, 0x00FF),
TestCase::masked(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0x08], 0xE8, 0x00FF),
TestCase::masked(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0x09], 0x1D, 0x00FF),
TestCase::masked(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0x0A], 0xF7, 0x00FF),
TestCase::masked(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0x0B], 0x02, 0x00FF),
TestCase::masked(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0x0C], 0xD6, 0x00FF),
TestCase::masked(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0x0D], 0x23, 0x00FF),
TestCase::masked(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0x0E], 0xC9, 0x00FF),
TestCase::masked(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0x0F], 0x3C, 0x00FF),
],
&Constraints {
width: 13,
poly: ValueRange::Range(0x0000..=0x1FFF),
init: ValueRange::Range(0x0000..=0x1FFF),
xorout: ValueRange::Fixed(0x0000),
refin: None,
refout: None,
},
&mut out,
);
println!("found {count} match(es) — written to results.txt");
}