## Diffie Hellman Key exchange algorithm:

Diffie Hellman algorithm is a public-key algorithm used to establish a shared secret that can be used for secret communications while exchanging data over a public network.

### It is primarily used as a method of exchanging cryptography keys for use in symmetric encryption algorithms. It was Proposed in 1976 by Whitfield Diffie and Martin Hellman. Diffie-Hellman is currently used in many protocols like Secure Sockets Layer (SSL)/Transport Layer Security (TLS), Secure Shell (SSH), Internet Protocol Security (IPSec), Public Key Infrastructure (PKI).

### Steps of Diffie Hellman key exchange Algorithm:

1 Requires two large numbers, one prime (P), and (G), a primitive root of P

2 P and G are both publicly available numbers

a. P is at least 512 bits

3 Users pick private values a and b

4 Compute public values

a. x = g

^{a }mod p
b. y = g

^{b }mod p
5 Public values x and y are exchanged

6 Compute shared, private key

a. k

_{a}= y^{a}mod p
b. k

_{b}= x^{b}mod p
c. Algebraically it can be shown that k

_{a}= k_{b}
Users now have a symmetric secret key to encrypt.

### Example

- Alice and Bob get public numbers
- P = 23, G = 9
- Alice and Bob compute public values
- X = 94 mod 23 = 6561 mod 23 = 6
- Y = 93
^{ }mod 23^{ =}729 mod 23 = 16 - Alice and Bob exchange public numbers
- Alice and Bob compute symmetric keys
- k
_{a}= y^{a}mod p = 16^{4}mod 23 = 9 - k
_{b}= x^{b}mod p = 63 mod 23 = 9

3. 9 is the shared secret.

#### Implementing the Diffie Hellman Key exchange algorithm in C Program

#### Output will be

Diffie Hellman Key exchange algorithm Implementation in C |

abc

ReplyDeletedef

Delete## Post a Comment