Add test for bug in padding validation and get ready for challenge 18.

This commit is contained in:
2022-07-05 19:13:15 -04:00
parent 57836c91f1
commit 29c2685b1a
3 changed files with 13 additions and 0 deletions

View File

@@ -404,6 +404,14 @@ pub fn challenge15() {
Bytes::from_utf8("ICE ICE BABY\u{3}\u{3}\u{4}\u{4}").has_valid_pkcs7(16),
false
);
assert_eq!(
Bytes::from_utf8("ICE ICE BABY!!!\u{0}").has_valid_pkcs7(16),
false
);
assert_eq!(
Bytes::from_utf8("ICE ICE BABY!!!\u{1}").has_valid_pkcs7(16),
true
);
let mut bytes = Bytes::from_utf8("ICE ICE BABY\u{3}\u{3}\u{4}\u{4}");
bytes.pad_pkcs7(16);
assert_eq!(bytes.has_valid_pkcs7(16), true);