开发者

Implementing the fair-coin flip

开发者 https://www.devze.com 2023-01-21 02:24 出处:网络
I was getting bored so I started looking a little into Cryptography. I got interested in this Fair-Coin Flipping protocol. This protocol w开发者_StackOverfloworks with public key cryptography but requ

I was getting bored so I started looking a little into Cryptography. I got interested in this Fair-Coin Flipping protocol. This protocol w开发者_StackOverfloworks 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:

  1. Alice and Bob both generate a public/private key pair (which is the commutative secret)
  2. 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.
  3. ...
  4. ...

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.?


Look at something like crypto++, rather than doing the cryptography yourself. There are other commercial libraries as well, but that should give you a good start.


I wrote a cryptography library as part of a university assignment on combinatorics. I used the GMP (GNUs Multiple Precision) library to generate random huge numbers (any number of bits that your computer can handle. So 4096 bit numbers are easy!)

0

精彩评论

暂无评论...
验证码 换一张
取 消