X-Git-Url: http://git.euphorik.ch/?p=crypto_lab1.git;a=blobdiff_plain;f=lab1_rust%2Fsrc%2Foracle_machine.rs;h=71cee8af3b09543cc482b1080088bacf16b40e1c;hp=018e2a5948cd024526ede01fba3eed4a25472f02;hb=d7f0bb987b21e93a5798403d294f7905151682f7;hpb=a8641e8dd205140af9206e82169ff5ad107c23f8 diff --git a/lab1_rust/src/oracle_machine.rs b/lab1_rust/src/oracle_machine.rs index 018e2a5..71cee8a 100644 --- a/lab1_rust/src/oracle_machine.rs +++ b/lab1_rust/src/oracle_machine.rs @@ -9,7 +9,7 @@ use end_point::EndPoint; /// Tries to decipher a ciphered data block by using the previous XOR operand and an oracle on the provided address and port. /// May print some messages on stdout. -pub fn decipher(address: &str, port: u16, original_xor_operand: &[u8, ..16], cipher_block: &[u8, ..16], variant: packet::Variant) -> Option> { +pub fn decipher(address: &str, port: u16, original_xor_operand: &[u8; 16], cipher_block: &[u8; 16], variant: packet::Variant) -> Option> { let mut end_point = EndPoint::new( match TcpStream::connect((address, port)) { Ok(s) => s, @@ -22,12 +22,12 @@ pub fn decipher(address: &str, port: u16, original_xor_operand: &[u8, ..16], cip ); // Sees 'packet::Packet' documentation for a complete description about the binary packet structure. - let mut final_packet = [0u8, ..2 + 1 + 8 + 32 + 10]; + let mut final_packet = [0u8; 2 + 1 + 8 + 32 + 10]; final_packet[1] = (final_packet.len() as u8) - 2; // Data length. copy_memory(final_packet.slice_mut(2 + 1 + 8 + 16, 2 + 1 + 8 + 32), cipher_block); - let mut decipher_block = [0u8, ..16]; // The result. - let mut x_prime_block = [0u8, ..16]; // The cipher block ('cipher_block') after AES and before XOR. + let mut decipher_block = [0u8; 16]; // The result. + let mut x_prime_block = [0u8; 16]; // The cipher block ('cipher_block') after AES and before XOR. let mut current_timestamp = 0u64; let mut first_byte = 0u8; // Used to save the first byte for the first iteration.