cryptopals-solutions icon indicating copy to clipboard operation
cryptopals-solutions copied to clipboard

Old Repo. See https://github.com/jaybosamiya/matasano-crypto instead

Matasano Crypto Challenges Solutions

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.

Solutions:

  1. Convert hex to base64
  2. Fixed XOR
  3. Single-byte XOR cipher
  4. Detect single-character XOR
  5. Implement repeating-key XOR
  6. Break repeating-key XOR
  7. AES in ECB mode
  8. Detect AES in ECB mode
  9. Implement PKCS#7 padding
  10. Implement CBC mode
  11. An ECB/CBC detection oracle
  12. Byte-at-a-time ECB decryption (Simple)
  13. ECB cut-and-paste
  14. Byte-at-a-time ECB decryption (Harder)
  15. PKCS#7 padding validation
  16. CBC bitflipping attacks
  17. The CBC padding oracle
  18. Implement CTR, the stream cipher mode
  19. Break fixed-nonce CTR mode using substitions
  20. Break fixed-nonce CTR statistically
  21. Implement the MT19937 Mersenne Twister RNG
  22. Crack an MT19937 seed
  23. Clone an MT19937 RNG from its output
  24. Create the MT19937 stream cipher and break it
  25. Break "random access read/write" AES CTR
  26. CTR bitflipping
  27. Recover the key from CBC with IV=Key
  28. Implement a SHA-1 keyed MAC