 Hello everyone, welcome to this week's recitation for CSC 365 information assurance. This week we're going to discuss the new assignment three, which deals with crypto. This assignment has four parts. Parts one and two are warmup problems, which will help you solve parts three and four. So please solve those parts before you end up solving parts three and parts four. All right, let's get started. So the part one is warmup that will help you break the Caesar Cipher as it was discussed in the class. You will be provided a ciphertext and your goal is to obtain the key. In order to obtain the ciphertext, you need to submit a solution, an empty file to the alpha text ciphertext problem. And once you submit the blank file, its output will contain the ciphertext that you actually need to break. And once you break the ciphertext and you obtain the key, you have to submit a readme file that contains a line which has the key in this specific format. And you also need to add a description on how you broke the cipher. And there's been some confusion on how you submit the solution. We have to submit the solution to the alpha test problem and not to the alpha test ciphertext problem. The alpha test ciphertext problem only gives you the ciphertext that you need to break. It does not grade your solution. The actual grading of your solution is done by the alpha test problem. And similarly for all the other parts in this assignment, you submit an empty file to all the star test ciphertext problems to get the ciphertext that you need to break. And you submit the solution with the key and a description on how you actually decrypted the ciphertext to the star test problems. Please refer to the assignment lecture or the slides on how you can actually break the cipher and you can double check if your solution is correct using the online cipher breaking tools that are linked to from the assignment. The second part is another warm-up question where you have to break the beginner cipher similar to the cipher that was discussed in the class. And just like part one, you will be given a ciphertext and your goal is to obtain the key. I highly encourage that you solve part one before attempting parts two because some of the solution approaches that you use in part one will also be useful for parts two itself. And just like part one, we have to submit a blank file to the beta test ciphertext problem in order to obtain the ciphertext that you need to decrypt. And once you decrypt the ciphertext and find the key used for encryption, you have to submit your solution to the beta test problem in order to check whether your solution is correct or not. The other submission instructions are the same as problem one. Please mention the key in this specific format and also include a description on how you broke the ciphertext in a file called read me with no extensions. Part three is one of the more involved problems in this assignment where we have given you a ciphertext that is again encrypted with the cipher. However, this cipher is not similar to the traditional cipher. The key difference is that instead of using just the alphabets a to z, we will operate on bytes. We have an alphabet of a total of 256 values ranging from zero to 255. The other key difference is that instead of the shift operation for encryption, we use the exclusive or for encrypting the plain text using the key. The key thing about the exclusive or operation is that the encryption and the decryption are the same process. There is no difference to encrypt you XOR decrypt you also XOR. Similar to parts one and two, you submit a blank file to the Julius test ciphertext problem to obtain the ciphertext that you need to break decrypt it and submit your solution to the Julius test problem for it to be graded. Your solution just like all the previous parts should contain a key in this specific format and a description of how you broke it. A key difference, however, is that you have to include the key in the hexadecimal form. And you which means that it should be prefixed with zero X. So as an example that you can see here if the key that you used for decrypting the ciphertext is zero X 80, you submit it in this format. Zero X 80 is the decimal number 128. We have also provided you some helper code that you can use. This is the actual encryption code right here. And an important thing to remember is that the ciphertext that you receive from great scope is actually base 64 encoded, which is an encoding that is used to represent non printable characters in some portable format. So this code here will help you encode and decode any text that is in base 64 or to base 64, but the actual encryption step is actually done in this function here. So below along with this helper code in Python, we have also included helper code in C and Java, which you can also reuse if you program in any of those languages. Okay, moving on to part four, the part four is similar to part two, we're again giving you a ciphertext encrypted with the beginner cipher, however, just like in part three. We have made a few modifications specifically the crypto system also operates on eight on a bite, just like in part three. And we use the explosive or operation instead of the shift operation. Similar to all the other parts in this assignment, you submit a blank file on the Allen test, sorry, in the Allen test ciphertext problem. And to get the ciphertext that you need to break and you need to submit the solution to the Allen test problem. And again, the ciphertext that you receive will be encoded using basic before that you would have to be code before you actually attempt breaking it. In part three, we've also given you functions that will help you decode and encode to base 64 and also have given you the encryption function that you need that is used to generate the ciphertext. And similar to all the previous assignments, your solution should include the key in this specific format and also a description and the code on how we broke the ciphertext set. Okay, that's the end of the walkthrough to this assignment. There are some questions that they're going to go. The first question that was asked is what is the difference between the test and the test ciphertext problems. As I said, the test ciphertext problem gives you the ciphertext that you actually need to break. And the test problem is where you will submit your solution to check whether it is correct or not. I know that some people on Gradescope have been submitting the solution also to the test ciphertext problem. Your solution will not be graded there. If you want a solution to be graded, please submit it on the test problems. How to calculate the index of coincidence for part two and for part four, how do we calculate it because the operation is different than the alphabet size is different. Does it vary with the alphabet. Yes, it does. The index of coincidence does vary with your alphabet size itself. In order to determine how you actually calculate the index of coincidence, look into the slides on cryptography. The slide number 30 has a formula for calculating the index of coincidence. And if you can analyze the formula, you will also see that it depends on the size of the alphabet itself. Another consequence of this is that you may find that the index of coincidence that you compute would be different from what you see on the slides. We have to remember that the index of coincidence also depends on the ciphertext itself and the characters that are involved in the ciphertext. We look at the formula, it will be very clear on why this difference happened. The next question that was asked was about, there is a difference between, I don't understand how the p64 encoded text gets XORed. If you look into this specific example here, we see that this string 90xd9a equal to equal to is decoded using the key x80 to bring the plain text test. What you need to remember is that this string is base 64 encoded and you have to do the base 64 decoding before you can actually do the decryption. And the key thing to remember is that for the XOR operation, the encryption and the decryption function is the same because the operation is the same. So always remember the ciphertext that is given to you for parts 3 and 4 are base 64 encoded and you have to do the base 64 decoding before you start attempting to break the ciphertext itself. The next question that was asked is in problems 4 for instance and also in problem 3, we see there is a b that is displayed in the output when you are printing the result of the decryption and also of the encryption. What does the b mean? The b is something that comes from Python 3. It's used to indicate that the result of this function is actually of the bytes data type and Python has a very nice representation when printing out to also sort of tell you that this is originally a byte string. I'm just going to try to print it out for you. So this b has actually nothing to do with the result of the encryption of the decryption. This string within the quotes is the actual result of the encryption and then the base 64 encoding. The b is just telling you that the result was returned as a byte string. The next question that was asked is what is the purpose of modulus in part 4? The question was about this specific line here. Why is there a modulus operator used in the key? You have to remember that this probably discussed in the lecture as well. The key is not necessarily as long as the plain text that is being encrypted. And when that happens, you end up repeating the key until it becomes as long as the text that needs to be encrypted. So one way of achieving that repetition is using the modulus operator to sort of wrap around. This is sort of saying that, okay, if the index that is being encrypted is greater than the length of the key, then go back and continue again from the start to find which character in the key has to be used for encrypting the plain text. The modulus operator is a nice way of simulating the wrap around back to the start when you have run out of characters in the key. Another question that was asked was, is the code that is specified in this assignment complete? Can we actually run it? Give it some plain text and our own keys to generate cyber text. Absolutely, the Python code that is specified in this description is complete. You can import it directly into a file or into the Python shell and give it your own input to see what outputs are provided. No other expert changes are required to run this code itself. The final question that was asked is, what is the bytes that are used in the encryption process? Are we supposed to use that in the description? The question is as opposed to this specific line and this specific line, why are the bytes being used? That has to do with the conversion that is being done because Python specifically works with the byte data type. And so we convert everything to bytes and work with bytes in this whole process. The actual encryption is only done in this specific line. The rest of it is all just data type handling in Python. You do not have to... Your decryption and breaking the cyber text does not depend upon any of these. This is all just language specific stuff. The actual encryption that you break is actually this operation here. That was all the questions that was actually asked in the recitation. If you have any further questions, please post them on the chat and we'd be happy to answer them. If you have any feedback on the recitation themselves, please post on Piazza or get in touch with us and we'd be happy to help you. Thank you and good luck for the assignment.