Reference no: EM132080175
What need to be Implemented The first step for you is to understand the steps involved in the Diffie-Hellman key exchange protocol. You need to implement a program as follows (a). Your program should take the size of the prime number p (in bits) as an argument during execution.
Based on the size of p, your program should be able to compute and print the values of p, the generator g, random numbers a, b ? Z * p , and other intermediate results computed in the Diffie-Hellman protocol.
Note that the values of p, g, a, and b have to be generated randomly by your program based on the input argument.
Your program should finally output the shared key generated. (b). Suppose your program name is Assignment2.java.
Here is a sample case of what your code is expected to output upon its execution >> java Assignment 5
The value of p selected: 23
The value of g selected: 5
The value of a selected by Alice: 6
The value of b selected by Bob: 15
The value of A sent to Bob by Alice: 8
The value of B sent to Alice by Bob: 19
The value of key shared between Alice and Bob: 2
In the above scenario, the program takes 5 as input meaning that the size of p should be 5 bits (i.e., the value of p should be selected in the range (16, 31]). Note that since the values of p, g, a, b are assumed to be generated randomly as per the Diffie-Hellman protocol, their values and the shared key value can be very different during each execution.
Please note that you can use any programming language (C, C++, Java, etc.) to implement this assignment as per your convenience.
However, it is your responsibility to check whether the programming language you select supports proper crypto libraries that you may want to use in your program. C, C++, JAVA and many other programming languages provide support for various crypto libraries which you can directly use to compute generators and random numbers in a group.
Also, note that your program should be able to handle large numbers (for example of size 1024 bits), therefore, you have to use large-number arithmetic built-in libraries depending on the language used.