diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/aes.rs | 8 | ||||
-rw-r--r-- | src/crack.rs | 5 |
2 files changed, 6 insertions, 7 deletions
@@ -100,8 +100,8 @@ fn test_encrypt_decrypt () { let ciphertext2_ecb = encrypt_aes_128_ecb(&plaintext2_ecb[..], &key[..]); let ciphertext2_cbc = encrypt_aes_128_cbc(&plaintext2_cbc[..], &key[..], &iv[..]); - assert_eq!(&plaintext[..], plaintext2_ecb); - assert_eq!(&plaintext[..], plaintext2_cbc); - assert_eq!(ciphertext_ecb, ciphertext2_ecb); - assert_eq!(ciphertext_cbc, ciphertext2_cbc); + assert_eq!(&plaintext[..], &plaintext2_ecb[..]); + assert_eq!(&plaintext[..], &plaintext2_cbc[..]); + assert_eq!(&ciphertext_ecb[..], &ciphertext2_ecb[..]); + assert_eq!(&ciphertext_cbc[..], &ciphertext2_cbc[..]); } diff --git a/src/crack.rs b/src/crack.rs index 5bd476d..a9aa4aa 100644 --- a/src/crack.rs +++ b/src/crack.rs @@ -2,7 +2,6 @@ use std; use std::ascii::AsciiExt; use std::borrow::ToOwned; use std::collections::{HashMap, HashSet}; -use std::num::Float; use data::ENGLISH_FREQUENCIES; use primitives::{fixed_xor, unpad_pkcs7, hamming, repeating_key_xor}; @@ -231,11 +230,11 @@ pub fn crack_querystring_aes_128_ecb<F> (encrypter: &F) -> (String, Vec<Vec<u8>> // encrypt: // email=..........admin<pcks7 padding>...............&uid=10&role=user - let calculate_admin_block = |block1, block2| { + let calculate_admin_block = |block1: Vec<u8>, block2: Vec<u8>| { for _ in 0..1000 { let email = "blorg@bar.admin\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b..............."; let ciphertext = encrypter(email); - if &ciphertext[48..64] == block1 || &ciphertext[48..64] == block2 { + if &ciphertext[48..64] == &block1[..] || &ciphertext[48..64] == &block2[..] { return ciphertext[16..32].to_vec(); } } |