Hi Sir Can you send the source code for diffie hellman key exchange implemented using matlab for transfer of data It's urgent Plz Plz....
Posts: 8,059
Threads: 1
Joined: Mar 2014
diffie hellman key exchange code
Diffie Hellman Key Exchange Algorithm (Java)
import java.util.*;
class DiffieHellman
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println(“Enter the value of Xa & Xb”);
int Xa=sc.nextInt();
int Xb=sc.nextInt();
System.out.println(“Enter a Prime no. p”);
int p=sc.nextInt();
System.out.println(“Enter Primitive Root a, such that a<p”);
int a=sc.nextInt();
int Ya=(int)((Math.pow(a,Xa))%p);
int Yb=(int)((Math.pow(a,Xb))%p);
int Ka=(int)((Math.pow(Yb,Xa))%p);
int Kb=(int)((Math.pow(Ya,Xb))%p);
if(Ka==Kb)
{
System.out.println(“Transmission successful”);
}
else
{
System.out.println(“Transmission failed”);
}
}
}