cryptopals

Matasano's cryptopals challenges (cryptopals.com).
Log | Files | Refs | README | LICENSE

commit d0743de8b8cac73cc4a977b2d3a9b44a33caf37a
parent a53dbd17117ef5b36f91c09f776a7b2e01222d4c
Author: Jared Tobin <jared@jtobin.io>
Date:   Sat, 17 Nov 2018 22:27:33 +1300

Update docs.

Diffstat:
MCargo.toml | 3++-
Mdocs/s1.md | 23+++++++++++++++++------
2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml @@ -7,6 +7,7 @@ authors = ["Jared Tobin <jared@jtobin.ca>"] base64 = "0.6" clap = "2.26" hex = "0.2" -openssl = "0.9" +openssl = "0.10" rand = "0.3" +combine = "2.5" diff --git a/docs/s1.md b/docs/s1.md @@ -2,18 +2,29 @@ #### 1.1 - $ SOLUTION=$(cat data/s1/q1_input.txt | ./bin/hex2b64) - $ diff <(echo $SOLUTION) data/s1/q1_output.txt +We want to go from hex (i.e., base 16) to base64 (i.e., base.. uh, 64). So +we'll change from the representation: -One could write no code at all: + .. + a2 * 16^2 + a1 * 16^1 + a0 * 16^0 - $ xxd -r -p data/s1/q1_input.txt | base64 +for some (decimal-equivalent) coefficients {a0, a1, .. } in the alphabet +0-9a-f, to the representation: -It's also fun to check the ASCII-encoded input: + .. + b2 * 64^2 + b1 * 64^1 + b0 * 64^0 - $ xxd -r -p data/s1/q1_input.txt +for other coefficients {b0, b1, .. } in the alphabet A-Za-z0-9\+/. + +`xxd` is a hexdump utility; one can use `xxd -r` to go from hex to binary, or +`xxd -r -p` to go from hex to ASCII: + + $ echo $(xxd -r -p data/s1/q1_input.txt) I'm killing your brain like a poisonous mushroom +The BSD `base64` utility gets one the rest of the way. An empty diff confirms +equality: + + $ diff <(xxd -r -p data/s1/q1_input.txt | base64) data/s1/q1_output.txt + #### 1.2 $ SOLUTION=$(./bin/fixed_xor $(< data/s1/q2_input.txt) $(< data/s1/q2_against.txt))