diff options
author | Jesse Luehrs <doy@tozt.net> | 2015-04-05 01:58:12 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2015-04-05 01:58:12 -0400 |
commit | 9fa38f13a7db4d8ef9f3398b68b8604e88b3bfdf (patch) | |
tree | 0744be8e600baeefdb8743e49979995f6f8d2edd | |
parent | 72e8d6fdd8644381ee82dbcbaab208a2547c52ce (diff) | |
download | matasano-9fa38f13a7db4d8ef9f3398b68b8604e88b3bfdf.tar.gz matasano-9fa38f13a7db4d8ef9f3398b68b8604e88b3bfdf.zip |
update rust
-rw-r--r-- | Cargo.lock | 39 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/aes.rs | 8 | ||||
-rw-r--r-- | src/crack.rs | 5 |
4 files changed, 28 insertions, 26 deletions
@@ -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" @@ -7,4 +7,4 @@ authors = ["Jesse Luehrs <doy@tozt.net>"] [dependencies] rustc-serialize = "0.3" openssl = "0.5" -rand = "0.2" +rand = "0.3" @@ -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<F> (encrypter: &F) -> (String, Vec<Vec<u8>> // encrypt: // email=..........admin<pcks7 padding>...............&uid=10&role=user - let calculate_admin_block = |block1, block2| { + let calculate_admin_block = |block1: Vec<u8>, block2: Vec<u8>| { 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(); } } |