Clean up challenge 1 for easier future use.

This commit is contained in:
2022-03-25 18:57:16 -04:00
parent fcf882991c
commit 4a077ade98
2 changed files with 117 additions and 73 deletions

View File

@@ -1,20 +1,7 @@
mod set1;
use crate::set1::{base64_to_string, bytes_to_base64, to_bytes};
fn test_set1() {
let input = to_bytes("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d");
let expected = String::from("SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t");
match input {
Ok(bytes) => {
let output = base64_to_string(bytes_to_base64(bytes));
assert_eq!(output, expected);
println!("{:?}", output);
}
Err(e) => println!("Error: {:?}", e),
};
}
use crate::set1::challenge1;
fn main() {
test_set1();
challenge1();
}