From 9fa38f13a7db4d8ef9f3398b68b8604e88b3bfdf Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 5 Apr 2015 01:58:12 -0400 Subject: update rust --- Cargo.lock | 39 +++++++++++++++++++++------------------ Cargo.toml | 2 +- src/aes.rs | 8 ++++---- src/crack.rs | 5 ++--- 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 45cdd11..a8904f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,9 +2,9 @@ name = "matasano" version = "0.0.1" dependencies = [ - "openssl 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -14,7 +14,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "gcc" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -24,7 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -37,34 +37,37 @@ dependencies = [ [[package]] name = "log" -version = "0.2.5" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "openssl" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "libressl-pnacl-sys 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pkg-config" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -74,15 +77,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rand" -version = "0.2.1" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-serialize" -version = "0.3.10" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/Cargo.toml b/Cargo.toml index e9006d0..544ff50 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,4 +7,4 @@ authors = ["Jesse Luehrs "] [dependencies] rustc-serialize = "0.3" openssl = "0.5" -rand = "0.2" +rand = "0.3" diff --git a/src/aes.rs b/src/aes.rs index 82b000c..d86246f 100644 --- a/src/aes.rs +++ b/src/aes.rs @@ -100,8 +100,8 @@ fn test_encrypt_decrypt () { let ciphertext2_ecb = encrypt_aes_128_ecb(&plaintext2_ecb[..], &key[..]); let ciphertext2_cbc = encrypt_aes_128_cbc(&plaintext2_cbc[..], &key[..], &iv[..]); - assert_eq!(&plaintext[..], plaintext2_ecb); - assert_eq!(&plaintext[..], plaintext2_cbc); - assert_eq!(ciphertext_ecb, ciphertext2_ecb); - assert_eq!(ciphertext_cbc, ciphertext2_cbc); + assert_eq!(&plaintext[..], &plaintext2_ecb[..]); + assert_eq!(&plaintext[..], &plaintext2_cbc[..]); + assert_eq!(&ciphertext_ecb[..], &ciphertext2_ecb[..]); + assert_eq!(&ciphertext_cbc[..], &ciphertext2_cbc[..]); } diff --git a/src/crack.rs b/src/crack.rs index 5bd476d..a9aa4aa 100644 --- a/src/crack.rs +++ b/src/crack.rs @@ -2,7 +2,6 @@ use std; use std::ascii::AsciiExt; use std::borrow::ToOwned; use std::collections::{HashMap, HashSet}; -use std::num::Float; use data::ENGLISH_FREQUENCIES; use primitives::{fixed_xor, unpad_pkcs7, hamming, repeating_key_xor}; @@ -231,11 +230,11 @@ pub fn crack_querystring_aes_128_ecb (encrypter: &F) -> (String, Vec> // encrypt: // email=..........admin...............&uid=10&role=user - let calculate_admin_block = |block1, block2| { + let calculate_admin_block = |block1: Vec, block2: Vec| { for _ in 0..1000 { let email = "blorg@bar.admin\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b..............."; let ciphertext = encrypter(email); - if &ciphertext[48..64] == block1 || &ciphertext[48..64] == block2 { + if &ciphertext[48..64] == &block1[..] || &ciphertext[48..64] == &block2[..] { return ciphertext[16..32].to_vec(); } } -- cgit v1.2.3-54-g00ecf