pub fn break_single_xor(ciphertext: Vec<u8>) {

    let mut best_score = 0;
    let mut key_guess: u8 = 0;
    for c in 0..255 {
        let decoded_text = single_key_xor(&ciphertext, c);
        let score_guess = score_text(decoded_text);
        if score_guess > best_score {
            best_score = score_guess;
            key_guess = c;
        }
    }
    
    println!("Final key: 0x{} ({})", key_guess, key_guess as char);
}
/// Decrypts ciphertext that has been XORed against a single byte
Decrypts ciphertext that has been XORed against a single byte
Decrypts ciphertext that has been XORed against a single byte
pub fn break_single_xor(ciphertext: Vec<u8>) {
    let mut best_score = 0;
    let mut key_guess: u8 = 0;
    for c in 0..255 {
        let decoded_text = single_key_xor(&ciphertext, c);
        let score_guess = score_text(decoded_text);
        if score_guess > best_score {
            best_score = score_guess;
            key_guess = c;
        }
    }
    println!("Final key: 0x{} ({})", key_guess, key_guess as char);
}
pub fn break_single_xor ( ciphertext : Vec < u8 > ) { let mut best_score = 0 ; let mut key_guess : u8 = 0 ; for c in 0 .. 255 { let decoded_text = single_key_xor ( & ciphertext , c ) ; let score_guess = score_text ( decoded_text ) ; if score_guess > best_score { best_score = score_guess ; key_guess = c ; } } println ! ( " " key_guess key_guess as char ) ; }
Decrypts ciphertext that has been XORed against a single byte
Decrypts ciphertext that has been XORed against a single byte
ciphertext
Vec<u8>
ciphertext
Vec<u8>