# How to use the key from a Diffie Hellman exchange? [closed]

I watched a YouTube video about Diffie-Hellman called "Diffie-Hellman Key Exchange", and it said after doing some modulo operations with the public modulus and generator and the random private numbers, you eventually arrive at a shared secret, or key between Bob and Alice (or whoever is exchanging data). Now that you have the key, how do you use the key to encrypt and decrypt data over whatever channel you are sending over? Do you use the key as the generator? Please give a mathematical example of how to encrypt and decrypt using the key.

## closed as too broad by e-sushi, archie, DrLecter, Seth, John DetersOct 17 '14 at 3:02

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• The answer to this question can range from "extremely simple" to "extremely complicated". The simplest answer is, once two parties share a secret key of sufficient length, they can use pretty much any symmetric-key encryption algorithm to exchange a single message. A lede to the more complicated answer is that if you want to exchange multiple messages, authenticate (one, both, or more) parties, or have other features, the key exchange must be part of a larger protocol such as TLS. – Stephen Touset Oct 13 '14 at 21:43
• Is there also a decryption algorithm for the encryption algorithm? Can i just use modulo somehow? Is there a mathematical formula for these algorithms? – Logern Oct 13 '14 at 22:26
• Wait now I understand I read a microsoft page about Symmetric and Asymmetric encryption. – Logern Oct 13 '14 at 22:36
• There are many different symmetric encryption algorithms; their selection, implementation, and use is an enormous topic and warrants another question (or many). – Stephen Touset Oct 13 '14 at 23:01
• Ok, but I read the microsoft page, and it said that an algorithm for symmetric encryption could be as simple as changing the letters by the key. – Logern Oct 13 '14 at 23:06