diff options
author | Jesse Luehrs <doy@tozt.net> | 2015-03-15 16:11:18 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2015-03-15 16:11:28 -0400 |
commit | ea9be053977c5730c8440685437abf0230062bb5 (patch) | |
tree | 498d82fd2f32006980d06406fe755332f08dd0d4 /src/lib.rs | |
parent | 3918fcd0b67cf9285e47e0c7b2a4d0e92fe01cda (diff) | |
download | matasano-ea9be053977c5730c8440685437abf0230062bb5.tar.gz matasano-ea9be053977c5730c8440685437abf0230062bb5.zip |
problem 7
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -1,4 +1,5 @@ extern crate "rustc-serialize" as serialize; +extern crate openssl; use std::ascii::AsciiExt; use std::num::Float; @@ -38,6 +39,15 @@ pub fn to_base64 (bytes: &[u8]) -> String { return bytes.to_base64(STANDARD); } +pub fn decrypt_aes_128_ecb (bytes: &[u8], key: &[u8]) -> Vec<u8> { + return openssl::crypto::symm::decrypt( + openssl::crypto::symm::Type::AES_128_ECB, + key, + vec![], + bytes + ) +} + pub fn fixed_xor (bytes1: &[u8], bytes2: &[u8]) -> Vec<u8> { return bytes1.iter() .zip(bytes2.iter()) |