summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2015-03-15 16:11:18 -0400
committerJesse Luehrs <doy@tozt.net>2015-03-15 16:11:28 -0400
commitea9be053977c5730c8440685437abf0230062bb5 (patch)
tree498d82fd2f32006980d06406fe755332f08dd0d4 /src/lib.rs
parent3918fcd0b67cf9285e47e0c7b2a4d0e92fe01cda (diff)
downloadmatasano-ea9be053977c5730c8440685437abf0230062bb5.tar.gz
matasano-ea9be053977c5730c8440685437abf0230062bb5.zip
problem 7
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index b8c6e33..e7f695d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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())