summaryrefslogtreecommitdiffstats
path: root/src/aes.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/aes.rs')
-rw-r--r--src/aes.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/aes.rs b/src/aes.rs
index 5ef1d8b..40d1c41 100644
--- a/src/aes.rs
+++ b/src/aes.rs
@@ -245,6 +245,14 @@ pub fn crack_querystring_aes_128_ecb<F> (encrypter: &F) -> (String, Vec<Vec<u8>>
return calculate_possible_admin_ciphertexts(admin_block);
}
+pub fn crack_cbc_bitflipping<F> (f: &F) -> Vec<u8> where F: Fn(&str) -> Vec<u8> {
+ let mut ciphertext = f("AAAAAAAAAAAAAAAA:admin<true:AAAA");
+ ciphertext[32] = ciphertext[32] ^ 0x01;
+ ciphertext[38] = ciphertext[38] ^ 0x01;
+ ciphertext[43] = ciphertext[43] ^ 0x01;
+ return ciphertext;
+}
+
fn count_duplicate_blocks (input: &[u8], block_size: usize) -> usize {
let mut set = HashSet::new();
let mut dups = 0;