summaryrefslogtreecommitdiffstats
path: root/tests/set3.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-04-09 03:04:54 -0400
committerJesse Luehrs <doy@tozt.net>2019-04-09 03:20:43 -0400
commit4c12a9eed43b6c0a2c3b194a7201ba25e0b8432b (patch)
tree8c8c5c1f92b955e05171b66b3a8d125608feaabf /tests/set3.rs
parentf92b84f214923a180b455eb7f5dbb69f6973db87 (diff)
downloadmatasano-4c12a9eed43b6c0a2c3b194a7201ba25e0b8432b.tar.gz
matasano-4c12a9eed43b6c0a2c3b194a7201ba25e0b8432b.zip
stop using rustc_serialize
Diffstat (limited to 'tests/set3.rs')
-rw-r--r--tests/set3.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/set3.rs b/tests/set3.rs
index 5d66e88..830d714 100644
--- a/tests/set3.rs
+++ b/tests/set3.rs
@@ -1,5 +1,4 @@
use rand::{FromEntropy, Rng};
-use rustc_serialize::base64::FromBase64;
mod util;
@@ -22,7 +21,7 @@ fn problem_17() {
static mut CHOSEN_PLAINTEXT_IDX: usize = 0;
let encrypter = || {
let idx = rand::thread_rng().gen_range(0, strings.len());
- let plaintext = strings[idx].from_base64().unwrap();
+ let plaintext = base64::decode(strings[idx]).unwrap();
unsafe { CHOSEN_PLAINTEXT_IDX = idx };
let iv = util::random_aes_128_key();
return (
@@ -45,17 +44,18 @@ fn problem_17() {
&validator,
);
let idx = unsafe { CHOSEN_PLAINTEXT_IDX.clone() };
- let expected = strings[idx].from_base64().unwrap();
+ let expected = base64::decode(strings[idx]).unwrap();
assert_eq!(plaintext, expected);
}
}
#[test]
fn problem_18() {
- let ciphertext = b"L77na/nrFsKvynd6HzOoG7GHTLXsTVu9qvY/2syL\
- XzhPweyyMTJULu/6/kXX0KSvoOLSFQ=="
- .from_base64()
- .unwrap();
+ let ciphertext = base64::decode(
+ &b"L77na/nrFsKvynd6HzOoG7GHTLXsTVu9qvY/2syL\
+ XzhPweyyMTJULu/6/kXX0KSvoOLSFQ=="[..],
+ )
+ .unwrap();
let plaintext =
&b"Yo, VIP Let's kick it Ice, Ice, baby Ice, Ice, baby "[..];
let got = matasano::aes_128_ctr(&ciphertext[..], b"YELLOW SUBMARINE", 0);