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

@@ -25,4 +25,5 @@ fn main() {
set2::challenge15();
set2::challenge16();
set3::challenge17();
set3::challenge18();
}

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);

View File

@@ -93,3 +93,7 @@ pub fn challenge17() {
assert_eq!(roundtrip, cleartext);
println!("[okay] Challenge 17: {}", roundtrip.to_utf8());
}
pub fn challenge18() {
println!("[xxxx] Challenge 18: ");
}