Prof. Wang sent out an encrypted message to ECE 443/518 students. Unfortunately he forgot the password as well as the original message. Prof. Wang still remembers how he obtained the encrypted message: first, a 256-bit key is generated as the SHA256 sum of a 4-digit password; then, AES-GCM is used to encrypt and authenticate the message with the nonce including all 0 bytes and the additional data being his email address.
For your convenience, Prof. Wang has put what he remembers in a Go program here. Now it is your turn to find the password and the original message using knowledge of cryptographic hash functions and ciphers.
Before you actually write code to find the password, you will first need to understand how to compute SHA256 hash and encrypt/decrypt with AES-GCM properly in Go. You will need to read the two functions validateSHA256() and validateAESGCM() and to observe their outputs in order to understand how they work. Answer the following questions in your project report:
Now you are ready to modify the function findPassword() to find the correct password and then the original message. I have provided a loop to generate all possible 4-digit password and you will need to add code to locate the correct one via brute-force attack. Answer the following questions in your project report:
Prof. Wang's story in previous sections reveals the danger of using a weak password consisting of just 4 digits. Let's consider theoretical and practical limits to understand how we can make use of stronger passwords. First of all, answer the following questions:
On the other hand, since attackers will be bounded by the available computational power, we may consider the time that an attacker takes to evaluate a password in order to estimate how long the password should be. Please do your own research to find how to measure time precisely in Go, and design experiments to answer the answer the following questions:
Complete the tasks for Section II to IV (5 points each), include them in a project report in .doc/.docs or .pdf format, and submit it to Canvas before the deadline for a total of 15 points.
The project should be done individually. You can discuss the project with other students but all the source code and writings should be your OWN. PLAGIARISM will be called for DISCIPLINARY ACTION. NEVER share your source code and reports with others.