CSS exp1_rollno__17
CSS exp1_rollno__17
Experiment No: 4
Roll No: 55 Name: Krutika pandya Div: B Batch: B1
Code-
#include <cmath>
#include <iostream>
{ if (b == 1)
return a;
else
// Driver program
int main()
cout << "The private key a for Alice : " << a << endl;
// of keys
cout << "Secret key for the Alice is : " << ka << endl;
cout << "Secret key for the Bob is : " << kb << endl;
return 0;
Output:-
Conclusion:- The Diffie-Hellman key exchange allows two parties to securely share a secret key
using public values and private keys. This ensures encrypted communication without directly
transmitting the secret key.