X-Git-Url: http://git.euphorik.ch/?p=crypto_lab1.git;a=blobdiff_plain;f=lab1_rust%2Fsrc%2Fmain.rs;fp=lab1_rust%2Fsrc%2Fmain.rs;h=967e0c70272cd8a18d72f34df8254fed7361d170;hp=0b14951a5777aba87219ad5143a4e4015dd70b44;hb=307b73948c18f26a4ff12fc29f9055397a999f44;hpb=ed4d8f3e7e028bf645089edb775af84e6c3f7bd4 diff --git a/lab1_rust/src/main.rs b/lab1_rust/src/main.rs index 0b14951..967e0c7 100644 --- a/lab1_rust/src/main.rs +++ b/lab1_rust/src/main.rs @@ -28,16 +28,16 @@ fn print_usage() { fn do_oracle_attack(address: &str, variant: packet::Variant) { // 16 bytes encrypted data from 'Packet::random_packet_data([4])'. - let cypher_block: [u8, ..16] = [254, 9, 228, 149, 60, 42, 165, 34, 233, 75, 112, 57, 37, 9, 116, 103]; // Known by the attacker. - let xor_operand: [u8, ..16] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3]; // This is the IV or the previous 16 bytes cypherblock. In our case we took the IV. + let cipher_block: [u8, ..16] = [254, 9, 228, 149, 60, 42, 165, 34, 233, 75, 112, 57, 37, 9, 116, 103]; // Known by the attacker. + let xor_operand: [u8, ..16] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3]; // This is the IV or the previous 16 bytes cipherblock. In our case we took the IV. let expected_clear_block: [u8, ..16] = [44, 92, 31, 98, 220, 84, 226, 53, 58, 94, 45, 25, 242, 6, 199, 1]; // To be found by the attacker. - match oracle_machine::decypher(address, PORT, &xor_operand, &cypher_block, variant) { - Some(ref decyphered) if decyphered.as_slice() == expected_clear_block => { + match oracle_machine::decipher(address, PORT, &xor_operand, &cipher_block, variant) { + Some(ref deciphered) if deciphered.as_slice() == expected_clear_block => { println!("The oracle machine has found the clear block!:"); println!(" Expected block: {}", expected_clear_block.to_vec()); - println!(" Decrypted block: {}", decyphered) + println!(" Decrypted block: {}", deciphered) } Some(ref other) => println!("The oracle machine hasn't found the clear block: {}", other),