Fundamentals 6: Modern Cryptography Basics
by Rathul Anand
Cryptography is the process of hiding information or communicating securely in an environment where everyone is trying to read the communication. Most cryptography examples involve Alice and Bob trying to communicate while Eve listens in. Today, we explore modern cryptography, heavily rooted in modular arithmetic. Modular arihmetic the language underlying modern cryptosystems. Many cryptographic alogirhtms rely on this arithmetic, where numbers "wrap around" after reaching a certain modulus. For example, the Diffie-Hellman Key Exchange (DHKE), which we covered today, leverages modular exponentiation to enable two parties to share a secret over an insecure channel. By applying modular arithmetic, both parties can compute the same shared secret without revealing or sharing their private keys. This principle forms the basis for secure communication in many asymmetric encryption schemes. We also cover the RSA cryptosystem, what it is, and what calculations are needed. Finally, we will have time to write writeups for challenges we have solved this quarter in cyber academy or elsewhere.
Slides
Challenges
The following challenges in increasing difficulty are deployed to platform.acmcyber.com to practice the concepts covered in the slides. We recommend working in the order below, as the challenges build upon themselves.
- Challenge 1 -
fundamentals/Modular Practice
- Challenge 2 -
fundamentals/RSA Practice
- Challenge 3 -
fundamentals/rubiks-cube
- Challenge 4 -
fundamentals/prime-factory
- Challenge 5 -
fundamentals/lunchly-exchange
Resources
The following resources are great to practice/learn about the ciphers covered in the slides.
- dcode.fr: This website hosts many classical ciphers, and provides tools for encryption, decryption, and automatic cracking of ciphers. This is a staple for classical cryptography challenges.
- Alpertron: A fast online integer factorization calculator for large numbers
- FactorDB: A large online database of integers and their factors.
- pycryptodome: A library that implements many modern-day cryptographic algorithms.
- cryptohack: A website with many challenges related to cryptography.
- Cyberchef: This website also hosts many ciphers, and provides tools for encryption, decryption, and automatic cracking. It is very powerful at detecting the cipher used in encryption if is unknown, and is also a staple for classical cryptography challenges.
- hackMD: A very useful markdown editor/publisher
- Twin Prime: Gary's writeup for Twin Primes from Buckeye CTF 2023, a good example of a writeup for an easier challenge.
- SHA256-CTR: Arnav's writeup for SHA256-CTR from SDCTF 2023, a good example of a writeup for a harder challenge.