2023-04-27 04:58:19 +00:00
|
|
|
#![feature(array_chunks)]
|
2023-04-28 03:19:27 +00:00
|
|
|
use cryptopals::{prelude::*, bvec64, friendly::{aes128, ecb_decrypt, ecb_encrypt}};
|
2023-04-27 04:58:19 +00:00
|
|
|
|
|
|
|
fn main() {
|
2023-04-28 01:37:59 +00:00
|
|
|
let key = *b"YELLOW SUBMARINE";
|
2023-04-27 04:58:19 +00:00
|
|
|
|
|
|
|
let input = bvec64!("input.txt");
|
2023-04-28 03:19:27 +00:00
|
|
|
let output = ecb_decrypt(&input, |block| aes128::decrypt(key, block));
|
2023-04-27 04:58:19 +00:00
|
|
|
|
|
|
|
dbg!(output.to_text().unwrap());
|
2023-04-28 03:19:27 +00:00
|
|
|
assert_eq!(input, ecb_encrypt(&output, |block| aes128::encrypt(key, block)));
|
2023-04-27 04:58:19 +00:00
|
|
|
println!("pass")
|
|
|
|
}
|