Question: using python Write a program that automatically breaks a shift cipher using the following simple heuristic: the letter that occurs most frequently in the ciphertext

using python Write a program that automatically breaks a shift cipher using the following simple heuristic: the letter that occurs most frequently in the ciphertext corresponds to plaintext 'e' (which, at 12.5% is the most frequent letter in English). Write a function simpleshiftbreak(ct) that given ciphertext ct, returns the key suggested by this heuristic. You can make use of the shift-cipher program shift.py we saw in class.

shift.py

def shift2(pt,k): 'plaintext pt, shift k' ptlst = encode(pt) ctlst = [(x+k) % 26 for x in ptlst] return decode(ctlst)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!