Created
July 15, 2016 05:45
-
-
Save dlwhitehurst/b7552bf5bb4894530af0c29c44e138f6 to your computer and use it in GitHub Desktop.
Anyway to better format this in the code module?
This file contains hidden or 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
#[test] | |
fn test_repeating_xor() { | |
use set1::challenge2::xor; | |
use rustc_serialize::hex::ToHex; | |
let plain_text_hex = "4275726e696e672027656d2c20696620796f752061696e277420717569636b20616e64206e696d626c650a4920676f206372617a79207768656e2049206865617220612063796d62616c"; | |
let key = "4943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943"; | |
let result = xor(plain_text_hex, key); | |
assert_eq!("0b3637272a2b2e63622c2e69692a23693a2a3c6324202d623d63343c2a26226324272765272a282b2f20430a652e2c652a3124333a653e2b2027630c692b20283165286326302e27282f",result.to_hex()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment