This set was surprisingly easy, actually. The book Understanding Cryptography by Paar & Pelzl is an excellent intro to the basic maths needed for crypto — namely, the group theory and number theory necessary for RSA and Diffie-Hellman.
Let’s dive in!
Challenge 33 Implement Diffie-Hellman
Diffie-Hellman is a remarkably simple algorithm for two parties to jointly compute a shared secret key that may be used, for example, as a key for symmetric encryption.
Alice and Bob agree on an integer group of prime , with a generator . raised to every power in , taken , can produce every element of . Hence, it is called a “generator” of the group.