summaryrefslogtreecommitdiffstats
path: root/src/aes.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2015-03-25 23:30:59 -0400
committerJesse Luehrs <doy@tozt.net>2015-03-25 23:30:59 -0400
commitfcdc3f0127fe841ecdf808d1941018f4fe7a2b85 (patch)
tree96498ab38434f4ca47a2d2e98374969ed15cdf7a /src/aes.rs
parentedf552548638c4532f99a18a6afd0738fbd789c0 (diff)
downloadmatasano-fcdc3f0127fe841ecdf808d1941018f4fe7a2b85.tar.gz
matasano-fcdc3f0127fe841ecdf808d1941018f4fe7a2b85.zip
problem 16
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;