summaryrefslogtreecommitdiffstats
path: root/tests/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib.rs')
-rw-r--r--tests/lib.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/lib.rs b/tests/lib.rs
index 3f66d16..c6f2413 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -282,3 +282,23 @@ fn problem_14 () {
let got = matasano::crack_padded_aes_128_ecb_with_prefix(&random_encrypter);
assert_eq!(got, padding);
}
+
+#[test]
+fn problem_15 () {
+ assert_eq!(
+ matasano::unpad_pkcs7(b"ICE ICE BABY\x04\x04\x04\x04"),
+ Some(&b"ICE ICE BABY"[..])
+ );
+ assert_eq!(
+ matasano::unpad_pkcs7(b"ICE ICE BABY\x05\x05\x05\x05"),
+ None
+ );
+ assert_eq!(
+ matasano::unpad_pkcs7(b"ICE ICE BABY\x01\x02\x03\x04"),
+ None
+ );
+ assert_eq!(
+ matasano::unpad_pkcs7(b"\x04\x04\x04\x04"),
+ Some(&b""[..])
+ );
+}