ElGamal
You are working in a multinational company and you have learned that the bookkeeping has been changing some key figures in reporting the revenues, taxes etc. to the authorities. In your position in the company you have been tasked with submitting the figures to the proper authorities. You would like to report the correct figures instead of the fake ones, but the numbers have been encrypted using ElGamal encryption. You have access to the public key parameters (parameters.txt) and the encrypted values (ciphertexts.txt). Each of the lines in the ciphertext file corresponds to the encryption of a single number in the reporting.
You know that the differences between the fake report and the original are the following:
1. The number on the first line has been multiplied by 1/6
2. The number on the third line has been halved
3. The number on the fourth line has been multiplied by 4
4. The number on the sixth line is the product of the first and fourth line
5. The number on the seventh line is the product of the 2nd, 3rd and 5th lines.
6. The number on the eighth line is the product of the fourth and the seventh line.
Your challenge is to generate a new encrypted file that decrypts the numbers to their original values instead of the fake ones, while conforming to the other rules in the report.
All values in the ciphertexts should be in the range from 1 to p (the ElGamal modulus given in the parameters.txt file.
Task 1: What is the encryption of the correct number in the first line?
Task 2: What is the encryption of the correct number in the third line?
Task 3: What is the encryption of the correct number in the fourth line?
Task 4: What is the encryption of the correct number in the sixth line?
Task 5: What is the encryption of the correct number in the seventh line?
Task 6: What is the encryption of the correct number in the eighth line?