Solutions to the Cryptopals crypto challenges in C++.
The repo is organized as:
CCrypto/— a small shared library (libCCrypto) with the crypto primitives and utilities used by the challenges (hex/base64 conversion, XOR, English-text scoring, hamming distance, PKCS#7 padding, ...).Challenges/setN/— one.cpp/.hpair per challenge (e.g.S01C06= Set 1, Challenge 6), plus a sharedmain.cppthat dispatches to the right challenge based on theSET/CHALLENGEbuild variables.assets/— sample data files used by the challenges (English text sample, ciphertexts, ...).
| Set | Challenges done |
|---|---|
| 1 | 1–8 |
| 2 | 1 |
g++with C++23 supportmakelibssl-dev(OpenSSL headers, the library links againstlibcrypto)
bear— to (re)generatecompile_commands.jsonfor clangd/LSP support- Docker + Docker Compose — see DEV.md for a containerized dev environment (neovim + tmux + Claude Code CLI, no local toolchain required)
From the repo root:
makeThis builds CCrypto and, by default, Set 1 / Challenge 1 in debug mode.
Pick a specific challenge and build type with variables:
make SET=1 CHALLENGE=6 # debug build (default)
make release SET=2 CHALLENGE=1 # release buildThe resulting binary is placed at:
bin/debug/cryptopalsS<SET>C<CHALLENGE> # BUILD=debug (default)
bin/release/cryptopalsS<SET>C<CHALLENGE> # BUILD=release
Run it directly, e.g.:
make SET=1 CHALLENGE=6 && ./bin/debug/cryptopalsS1C6make list # list available challenge sets
make clean # remove build artifacts (challenges + CCrypto)
make clean-all # clean plus remove build/bin directories
make compile_commands # regenerate compile_commands.json with bear
make help # show all targets and variablesSee DEV.md for how to work inside the provided Docker dev container (neovim, tmux, and Claude Code preconfigured, no need to install a local toolchain).