diff options
author | Jesse Luehrs <doy@tozt.net> | 2015-03-25 23:30:59 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2015-03-25 23:30:59 -0400 |
commit | fcdc3f0127fe841ecdf808d1941018f4fe7a2b85 (patch) | |
tree | 96498ab38434f4ca47a2d2e98374969ed15cdf7a /src/aes.rs | |
parent | edf552548638c4532f99a18a6afd0738fbd789c0 (diff) | |
download | matasano-fcdc3f0127fe841ecdf808d1941018f4fe7a2b85.tar.gz matasano-fcdc3f0127fe841ecdf808d1941018f4fe7a2b85.zip |
problem 16
Diffstat (limited to 'src/aes.rs')
-rw-r--r-- | src/aes.rs | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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; |