The guys over at Matasano have made a set of 48 challenges that show attacks on real-world crypto. This repository contains solutions to the challenges, as and when I solve them.
All the solutions in this repository have been written in Python 2.7 and can be run by running python run.py
in the directory of the challenge.
Everything in this repository is covered under the MIT License.
- Convert hex to base64
- Fixed XOR
- Single-byte XOR cipher
- Detect single-character XOR
- Implement repeating-key XOR
- Break repeating-key XOR
- AES in ECB mode
- Detect AES in ECB mode
- Implement PKCS#7 padding
- Implement CBC mode
- An ECB/CBC detection oracle
- Byte-at-a-time ECB decryption (Simple)
- ECB cut-and-paste
- Byte-at-a-time ECB decryption (Harder)
- PKCS#7 padding validation
- CBC bitflipping attacks
- The CBC padding oracle
- Implement CTR, the stream cipher mode
- Break fixed-nonce CTR mode using substitions
- Break fixed-nonce CTR statistically
- Implement the MT19937 Mersenne Twister RNG
- Crack an MT19937 seed
- Clone an MT19937 RNG from its output
- Create the MT19937 stream cipher and break it
- Break "random access read/write" AES CTR
- CTR bitflipping
- Recover the key from CBC with IV=Key
- Implement a SHA-1 keyed MAC