Solutions to set 1

This commit is contained in:
2023-04-26 21:58:19 -07:00
parent 6cceb35c3d
commit e5edf80da4
26 changed files with 1179 additions and 0 deletions

View File

@ -0,0 +1 @@
1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736

16
examples/set1_3/main.rs Normal file
View File

@ -0,0 +1,16 @@
use cryptopals::{prelude::*, bvec};
fn main() {
let input = bvec!("input.txt");
let best = (u8::MIN..=u8::MAX).map(
|possibility| {
let result = input.xor_repeating(&vec![possibility]).unwrap();
let score = cryptopals::english::score(&result);
(possibility, result, score)
}
).max_by_key(|(_,_,score)| *score).unwrap();
dbg!(best.0);
dbg!(best.1.to_text().unwrap());
println!("pass!")
}