1. Breaking Shift and Vigenere.
The goal of this question is for you to break both a Shift Cipher and a Vigenere Cipher as a cipher text only adversary. This will require a small amount of programming, for reference my implementation in python is about 110 lines of code, so nothing too crazy. Two text files can be found on the class calendar where you found this exercise set. One is shift-enc and the other is vig-enc, these are cipher texts encrypted using a shift and Vigenere cipher respectively. To make your life a bit easier I have also included two supplemental files shift-freq and vig-freq that are the letter frequencies of each plain text file. Note that the sum of squares of letter distribution is slightly di↵erent than standard English, 0.066 in both cases.
• Break the shift cipher. To demonstrate success provide for me the first 50 or so characters along with what key (shift was used).
• Break the Vigenere cipher. Again, to demonstrate success provide both the first 50 or so characters and the recovered key. Hint, you should be able to call into the overwhelming majority of your shift cipher code, saving you some time.
• Provide either a description of how your program functions or include a copy of the source code. In general I would rather see source code, but if it is especially bulky a written summary is acceptable.

2. Chosen Plaintext Attackers and Classical Ciphers
Show that the shift, substitution, and Vigenere ciphers are all trivial to break for an adversary executing a chosen plaintext attack. How much chosen plaintext is needed to recover the key for each of the ciphers?

3. Repeated Uses of OTPs
We know that One Time Pads are Perfectly Secret, assuming that the key size is the same as the message size and that we do not re-use keys. Demonstrate that if a OTP is re-used multiple times the cipher is no longer perfectly secret. To do this build a Cipher Text Only attack which recovers the OTP pad given “enough” cipher texts. For a fun historical note, you are replicating an attack launched by American cryptographers during the cold war against Soviet diplomatic messages.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

# distribution
from builtins import print

SIZE = 26
a = ord('a')

# initialize q and p array
q = []
p = []
for i in range(SIZE):

# open cipher file
cipherFile = open('shift-enc.txt', 'r')
# print(

# read file to count characters
cipherLen = 0
for ch in
    # get its ascii value
    t = ord(ch) - a
    q[t] = q[t] + 1
    cipherLen = cipherLen + 1


# calculate frequency of each encrypted character
index = 0
while index < len(q):
    q[index] = q[index] / cipherLen
    index += 1

# read frequency file

with open('shift-freq.txt', 'r') as f:
    for line in f:
       #print(line, end='')
       y = line.split(",")
       # print(y[0], ' ' , float(y[1]))
       t = ord(y[0]) - a
       p[t] = float(y[1])
       # print(p[t])

# try to break the encrypted code

k = 0
diff = 1.0...

By purchasing this solution you'll be able to access the following files:

for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Cryptography Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats