solutions / cryptopals / set1 /
..
data add new solution for cryptopals set 1 challenge 4 9 months ago
include rewrote xor detect script in c 7 months ago
lib fix code formatting 7 months ago
test rewrote xor detect script in c 7 months ago
.gitignore rewrote xor detect script in c 7 months ago
HEX2BASE64.md fix directory structure even further 7 months ago
Makefile rewrote xor detect script in c 7 months ago
README.md add sections to readme and fix a wrong affirmation 7 months ago
fixed-xor.c fix code formatting 7 months ago
hex2base64.c fix code formatting 7 months ago
run_test.sh add solution to challenge 2 of set 1 9 months ago
xor_cipher_decode.c fix code formatting 7 months ago
xor_cipher_detect.c fix code formatting 7 months ago
README.md

Cryptopals set1

Important note

Most of these takes hexadecimal strings as input. But we don't manipulate them as is. We use the hex_decode function like that:

int bytes_count;
hex_decode("6d757368726f6f6d", &bytes_count);
// => "mushroom"

Binaries

File Description
fixed-xor xors two hexadecimal strings together
hex2base64 convert an hexadecimal string to its base64 representation
xor_cipher_decode bruteforce a xor-ed string and compute a score to select the most probable key
xor_cipher_detect will call xor_decode() on several hexadecimal string and select the best decoded string

Functions

Name File Description
hex_decode lib/hex.c convert the hexadecimal representation of a string to the corresponding ascii string
hex_encode lib/hex.c convert an ascii string to it's hexadecimal representation
xor_string_in_place lib/xor_string_in_place.c simply perform a bitwise xor on a string against another string
xor_decode lib/xor_decode_single_string.c bruteforce a xor-ed string and compute a score to select the most probable key