cryptopals

Matasano's cryptopals challenges (cryptopals.com).
Log | Files | Refs | README | LICENSE

commit f5e296b7aff44a16e70dd68588e4204b169ca2c6
parent e6461700dac973f8976bef1200c626cd38181ac6
Author: Jared Tobin <jared@jtobin.ca>
Date:   Sat, 27 May 2017 22:23:30 +1200

Add pure xor.

Diffstat:
Mdocs/s2.md | 3+--
Mlib/aes_ecb/src/main.rs | 10++++++++++
2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/docs/s2.md b/docs/s2.md @@ -15,6 +15,5 @@ I'm back and I'm ringin' the bell A rockin' on the mike while the fly girls yell -The problem description says NO OPENSSL, but I don't actually have much -experience with openssl, so it's fun to check out. +The problem description says NO OPENSSL, but heck them rules AMIRITE? diff --git a/lib/aes_ecb/src/main.rs b/lib/aes_ecb/src/main.rs @@ -7,6 +7,16 @@ use openssl::symm::{Cipher, Crypter, Mode}; use std::io::{self, Read}; use clap::{App, Arg}; +fn fixed_xor(target: Vec<u8>, partner: Vec<u8>) -> Vec<u8> { + assert_eq!(target.len(), partner.len()); + + target + .iter() + .zip(partner) + .map(|(&l, r)| l ^ r) + .collect() +} + fn crypt(cipher: Cipher, mode: Mode, key: &[u8],