Created
July 13, 2016 04:36
-
-
Save dlwhitehurst/a42e7dc0af017a282d23cea2fff9b23e to your computer and use it in GitHub Desktop.
This is not working
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate rustc_serialize; | |
use rustc_serialize::hex::{FromHex,ToHex}; | |
use std::fmt::LowerHex; | |
use std::iter; | |
fn main() { | |
let hex_str = "1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736"; | |
for x in 0..256 { | |
// do | |
let hexkey = format!("{:02x}",x); | |
let bigkey = hexkey.iter().repeat().take(34).collect::<String>(); | |
println!("{}",bigkey); | |
} | |
// let a = "58585858585858585858585858585858585858585858585858585858585858585858"; | |
let a = "66666666666666666666666666666666666666666666666666666666666666666666"; | |
let result = xor(hex_str,a); | |
println!("{:?}",String::from_utf8(result)); | |
} | |
/* | |
This function does an exclusive or operation on two hexadecimal strings | |
*/ | |
fn xor(a: &str, b: &str) -> Vec<u8> { | |
return a.from_hex().unwrap().iter().zip(b.from_hex().unwrap().iter()).map(|(&x,&y)|x^y).collect(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment