Solve the Cryptopals Crypto Challenges using pure C.
- This repository contains my implementations, notes, and explanations for each challenge set, focused on clarity, correctness, and learning modern applied cryptography from first principles.
Basically a quiet Saturday and I am in need of a challenge, so I am speedrunning the Cryptopals challenges in C code, just for fun.
The Cryptopals Challenges are a well-known set of practical cryptography exercises covering topics like:
- Encoding and decoding
- XOR ciphers
- Block ciphers (AES)
- Padding oracles
- CBC, CTR, stream attacks
- Diffie–Hellman, RSA, and more
This repo is my attempt to solve them from scratch in C, without relying on high-level crypto libraries unless the challenge's intent allows it.
The goal is to deeply understand how the primitives work internally.
There is a doxygen PDF in ./docs
Unit tests rely on the excellent
utest.h project, which is vendored
as a Git submodule at third_party/utest.h. After cloning this repository,
pull the dependency with:
git submodule update --init --recursiveTo refresh the dependency at a later date, run:
git submodule update --remote third_party/utest.hIf your environment blocks outbound network access (as is common in some
CI/automation setups), make sure the required utest.h sources are available
before attempting to build or run the tests.
- C99 or newer
- Make
- doxygen and pdflatex/texlive environment for docs
Common combinations of the below:
make clean
make
make test
make docs- This code is for my own amusement and educational purposes only.
- Do not use it in production, security-critical, or cryptographic applications.