Update but nothing new
parent
35d81605e2
commit
959093c408
|
@ -1,3 +1,9 @@
|
||||||
|
////
|
||||||
|
// Cryptopal set 1 chal 1 : https://cryptopals.com/sets/1/challenges/1
|
||||||
|
// Run with :
|
||||||
|
// cargo run -- 49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d
|
||||||
|
////
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
fn hex_to_char(s: &str) -> Result<char, std::num::ParseIntError> {
|
fn hex_to_char(s: &str) -> Result<char, std::num::ParseIntError> {
|
||||||
|
@ -13,7 +19,15 @@ fn main() {
|
||||||
.map(|chunk| chunk.iter().collect::<String>())
|
.map(|chunk| chunk.iter().collect::<String>())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
for s in split {
|
// Printing the string in Ascii format - for decoding example
|
||||||
println!("{:?}", hex_to_char(s));
|
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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue