summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
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())