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
Get step-by-step solutions from verified subject matter experts
