From 959093c4084a5dc13a99eb86485a902c8ae74125 Mon Sep 17 00:00:00 2001 From: beneth Date: Fri, 3 Apr 2020 21:04:19 +0200 Subject: [PATCH] Update but nothing new --- set1/chal1/src/main.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/set1/chal1/src/main.rs b/set1/chal1/src/main.rs index c9bc164..e912976 100644 --- a/set1/chal1/src/main.rs +++ b/set1/chal1/src/main.rs @@ -1,3 +1,9 @@ +//// +// Cryptopal set 1 chal 1 : https://cryptopals.com/sets/1/challenges/1 +// Run with : +// cargo run -- 49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d +//// + use std::env; fn hex_to_char(s: &str) -> Result { @@ -13,7 +19,15 @@ fn main() { .map(|chunk| chunk.iter().collect::()) .collect::>(); - for s in split { - println!("{:?}", hex_to_char(s)); + // Printing the string in Ascii format - for decoding example + for (i, s) in split.iter().enumerate() { + match hex_to_char(s) { + Ok(s) => print!("{}", s), + Err(e) => println!("\nError decoding char '{}' at index {}", e, i), + } } + println!(); + + // Now we can unroll the base64 algorithm + // We need to : http://www.herongyang.com/Encoding/Base64-Encoding-Algorithm.html }