summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2015-03-27 00:16:51 -0400
committerJesse Luehrs <doy@tozt.net>2015-03-27 00:16:51 -0400
commitf0af2c1b75c366b228925a8b88cf3bf19066dc41 (patch)
treef86c4fb0cf696db2e411ef95e591b3a543d0d309 /tests
parentb466bae50a91da358f9e4264d312fb836c7cd829 (diff)
downloadmatasano-f0af2c1b75c366b228925a8b88cf3bf19066dc41.tar.gz
matasano-f0af2c1b75c366b228925a8b88cf3bf19066dc41.zip
make the decrypt primitives return options based on valid padding
Diffstat (limited to 'tests')
-rw-r--r--tests/lib.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/lib.rs b/tests/lib.rs
index cc37ec4..3dbfa55 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -107,7 +107,7 @@ fn problem_7 () {
let key = b"YELLOW SUBMARINE";
let plaintext = read("data/7.out.txt");
let got = matasano::decrypt_aes_128_ecb(&ciphertext[..], key);
- assert_eq!(got, plaintext);
+ assert_eq!(got, Some(plaintext));
}
#[test]
@@ -139,7 +139,7 @@ fn problem_10 () {
let key = b"YELLOW SUBMARINE";
let plaintext = read("data/10.out.txt");
let got = matasano::decrypt_aes_128_cbc(&ciphertext[..], key, &[0; 16]);
- assert_eq!(got, plaintext);
+ assert_eq!(got, Some(plaintext));
}
#[test]
@@ -228,7 +228,7 @@ fn problem_13 () {
matasano::encrypt_aes_128_ecb(profile_for(email).as_bytes(), &key[..])
};
let decrypter = |ciphertext: &[u8]| -> Option<HashMap<String, String>> {
- let plaintext = matasano::decrypt_aes_128_ecb(ciphertext, &key[..]);
+ let plaintext = matasano::decrypt_aes_128_ecb(ciphertext, &key[..]).unwrap();
let plaintext_str = std::str::from_utf8(&plaintext[..]).unwrap();
if let Some(params) = matasano::parse_query_string(plaintext_str) {
return Some(
@@ -327,7 +327,7 @@ fn problem_16 () {
};
let verify = |ciphertext: &[u8]| -> bool {
- let plaintext = matasano::decrypt_aes_128_cbc(ciphertext, &key[..], &iv[..]);
+ let plaintext = matasano::decrypt_aes_128_cbc(ciphertext, &key[..], &iv[..]).unwrap();
return (0..(plaintext.len() - admin.len())).any(|i| {
plaintext
.iter()