From fb8c6b000c15f6324d8bc87baeafeb2d8fc1459f Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 25 Mar 2015 19:52:13 -0400 Subject: problem 15 --- tests/lib.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests') 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""[..]) + ); +} -- cgit v1.2.3-54-g00ecf