I was getting bored so I started looking a little into Cryptography. I got interested in this Fair-Coin Flipping protocol. This protocol works with public key cryptography but requires that the algorithm commute (something like RSA I guess). I thought it would be fun to write this in either C or C++ and was wondering how people generally do this public key cryptography in C or C++. For instance, the first few steps of the protocol are:
- Alice and Bob both generate a public/private key pair (which is the commutative secret)
- Alice generates two messages, one indicating heads and the other indicating tails and encrypts both of them using her key and sends them to Bob.
- ...
- ...
Now, for the message, I will use perhaps a string but are there any good libraries for generating the public/private keys and encrypting a given string etc.?