summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2015-03-25 19:52:13 -0400
committerJesse Luehrs <doy@tozt.net>2015-03-25 19:52:13 -0400
commitfb8c6b000c15f6324d8bc87baeafeb2d8fc1459f (patch)
tree924055959e1477ee806fa097c88abef6f8a4a774 /tests
parent3eed3478478d54ca44c1842f460b44078ad5316e (diff)
downloadmatasano-fb8c6b000c15f6324d8bc87baeafeb2d8fc1459f.tar.gz
matasano-fb8c6b000c15f6324d8bc87baeafeb2d8fc1459f.zip
problem 15
Diffstat (limited to 'tests')
-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""[..])
+ );
+}