[SOUND] Hello, welcome back to the video lectures on web connectivity and security in cyber physical systems. In this video lecture, we are going to learn how two parties that don't know each other previously can share a secret through a public medium like the Internet. The shared secret could be and often is the encryption key of a symmetric key cipher system. The Diffie-Hellman key exchange algorithm was published in 1976 as one of the first public key protocols for securely exchanging cryptographic keys over public networks. The algorithm is based on the concept of discrete logarithms. Diffie-Hellman is not an actual encryption algorithm, meaning that it's not used to protect data transfer between two parties. Let's explore how the Diffie-Hellman protocol works. Suppose that Alice and Bob don't know each other and they would like to share an encryption key of a symmetric cipher in order to initiate secure communication. To do this, first, Alice and Bob have to agree on two numbers, a sufficiently large prime number p and a base generator g, which is a primitive root modulo P. Alice chooses a secret number or key a and computes her public result, capital A, as g to the power of a mod p and sends it to Bob. Bob also chooses a secret number or key b and computes his public results, capital B, as g to the power of b mod P and sends it to Alice. At this point, a potential attacker may intercept their communication and get the public results A and B. He might also capture p and g when Alice and Bob are agreeing on these numbers. Now, Alice computes a shared secret S1 with her secret key a as B to the power of a mod p. And, likewise, Bob computes a shared secret S2 with his secret key b as A to the power of b mod p. It can be mathematically proven that S1 and S2 actually have the same value. This shared number is Alice's and Bob's shared secret and can be used as an encryption key of a symmetric cipher. Because the attacker doesn't know the secret keys a and b, he will not be able to compute the shared secret. We just learned how Diffie-Hellman is implemented mathematically. Let's have a simpler example in order to demonstrate how the protocol works. Suppose Alice and Bob know a common color yellow. Alice chooses pink color and Bob chooses green color as their secret colors. Alice mixes her secret color with the common color and produces a new color. Bob also does the same. They exchange the new colors. Now they mix the new colors with their secret colors and produce yet another color. Since the final color on each side is made of the same combination of three colors, yellow, pink and green, it is identical on both sides. So, Alice and Bob ended up with the same final color without revealing their own secret colors to each other. As you can see on the screen, the same thing happens mathematically. The final values computed on each side are actually identical. Diffie-Hellman is one of the most powerful security protocols and is therefore still widely used in many applications. For resource constraint devices, the Diffie-Hellman protocol can be implemented using elliptic curve cryptography. If you are interested to learn more about lightweight Diffie-Hellman protocols, you can search on the web for elliptic curve Diffie-Hellman. You will find many useful tutorials on this topic. In this video lecture, we saw how the Diffie-Hellman protocol is used to share secret information. In the next lesson, we will learn how to establish a public key crypto system to secure digital communication. [SOUND]