How to Generate Private Encryption Keys with the Diffie-Hellman Key Exchange

When we are building programs that communicate over a network, how can we keep our data private? The last thing we want is some other lousy hacker sniffing our packets, so how do we stop them? The easy answer: encryption. However, this is a very wide-ranging answer. Today we're going to look specifically at how to encrypt data in Python with dynamically generated encryption keys using what is known as the Diffie-Hellman key exchange. The Problem Encrypting data is a fairly straightforward process. You simply generate a key, run an encryption algorithm against some information using that key... more