WIP for improving my chi2 algorithm so it works on s1c4
This commit is contained in:
parent
76bc8895cc
commit
1cb5b59763
3 changed files with 27 additions and 7 deletions
|
@ -81,7 +81,7 @@ fn s1c4() {
|
|||
let mut best_score = f32::INFINITY;
|
||||
let mut best_output: Option<String> = None;
|
||||
for key in 32u8..127 {
|
||||
let decrypted = decoded.iter().byte_xor(key).map(char::from).collect::<String>();
|
||||
let decrypted = decoded.iter().map(|c| *c).byte_xor(key).map(char::from).collect::<String>();
|
||||
let score = decrypted.chi2_freqs("en");
|
||||
if !score.is_nan() && score < best_score {
|
||||
best_score = score;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue