CS 6222: Introduction to Cryptography (Python代写,CS 6222代写,University of Virginia代写,北美程序代写,美国程序代写)

Your goal is to decrypt the _last_ ciphertext in the file (shown in blue in the above example)

微信: biyeprodaixie 欢迎联系咨询

本次CS代写的主要涉及如下领域: Python代写,CS 6222代写,University of Virginia代写,北美程序代写,美国程序代写

CS 6222: Introduction to Cryptography Spring 2020

Homework 1A: Many-Time Pad Attack

Due: January 22, 2020 at 5pm (Submit on Collab) Instructor: David Wu

Instructions. This problem is one component of Homework 1 (and is worth 20% of the credit on Homework 1). Please read the submission instructions carefully before submitting your assignment.

Collaboration Policy. You may discuss your general high-level strategy with other students, but you may not share any written documents or code. Your challenge is unique to your computing ID, and you must solve your challenge independently. Do not share your challenge with anyone other than members of the course staff. You must include the computing IDs of all of your collaborators with your submission (see specific instructions below).

Acknowledgments. This problem is adapted from a homework assignment from Stanford’s CS 255 course by Prof. Dan Boneh.

Problem 1: Many-Time Pad Attack [18 points]. In lecture, we said that we should never reuse a one- time pad (or more generally, a stream cipher) to encrypt multiple messages. In this exercise, we will see

why this is the case. On Collab (under your private folder in “File Drop”), you will find a file (ctxts.txt)

that contains a collection of 12 hex-encoded ciphertexts that are the result of encrypting 12 plaintext messages with the same one-time pad. Each ciphertext appears on a separate line. The file will look something like the following:^1


Your goal is to decrypt the last ciphertext in the file (shown in blue in the above example). In this example, the answer is:

Cryptographers seldom sleep well. ~ Joe Kilian

(^1) The real file will contain ciphertexts for 60-character messages. The example shown here is for shorter (46 character) messages.

Submission instructions. To submit, please upload two files to Collab:answer.txtandcollab.txt:

  • answer.txt: This file should consist of a single line which is the decrypted ciphertext (see example above). You should only decrypt the last ciphertext.
  • collab.txt: This file should consist of a single line with a comma-separated list of your collabora- tors’ computing IDs.

This assignment will be auto-graded so not conforming with the above requirements will result in your assignment automatically receiving a grade of zero.

Additional information. In case it is useful, the ciphertexts for this assignment were generated using the following Python script:

import os
def encrypt(pad, msg):return bytes([x ^ ord(y) for (x, y) in zip(pad, msg)]).hex()
pad = os.urandom(60)ctxts = [encrypt(pad, m) for m in msgs]

Some additional hints:

  • Every message is an English sentence (with possible punctuation). The start and end of each message may be in the middle of a word.
  • In Python, you can use thebytes.fromhex(...) function to obtain a byte array from a hex- encoded value.
  • Think about what happens when a space is xored with a letter.