summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2015-03-15 16:50:51 -0400
committerJesse Luehrs <doy@tozt.net>2015-03-15 16:51:01 -0400
commit802eed2e3c699e0b63d6e69a5be7058135060f17 (patch)
tree5ae1d300692fd663e492944fc3a3680337f229be /tests
parentd6578f1357f7ae10feb9e4a4fae1a1953739557a (diff)
downloadmatasano-802eed2e3c699e0b63d6e69a5be7058135060f17.tar.gz
matasano-802eed2e3c699e0b63d6e69a5be7058135060f17.zip
problem 8
Diffstat (limited to 'tests')
-rw-r--r--tests/lib.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/lib.rs b/tests/lib.rs
index b537bd0..1761d77 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -75,3 +75,14 @@ fn problem_7 () {
let plaintext = outfh.bytes().map(|c| c.unwrap()).collect();
assert_eq!(got, plaintext);
}
+
+#[test]
+fn problem_8 () {
+ let fh = File::open("data/8.txt").unwrap();
+ let possibles = std::io::BufStream::new(fh)
+ .lines()
+ .map(|line| line.unwrap().from_hex().unwrap())
+ .collect::<Vec<Vec<u8>>>();
+ let ecb_encrypted = "d880619740a8a19b7840a8a31c810a3d08649af70dc06f4fd5d2d69c744cd283e2dd052f6b641dbf9d11b0348542bb5708649af70dc06f4fd5d2d69c744cd2839475c9dfdbc1d46597949d9c7e82bf5a08649af70dc06f4fd5d2d69c744cd28397a93eab8d6aecd566489154789a6b0308649af70dc06f4fd5d2d69c744cd283d403180c98c8f6db1f2a3f9c4040deb0ab51b29933f2c123c58386b06fba186a".from_hex().unwrap();
+ assert_eq!(matasano::find_aes_128_ecb_encrypted_string(&possibles[..]), ecb_encrypted);
+}