Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are to write a program called {vigenereic.py} that takes as input the following Vigenre ciphertext : GCMKGKRDBYTZLRORMTZLROGFEXIKCORSNSDZHFAZWLNCLIZIMZFWOTIPJIJOBIVQSPYURVTCSKTSNZJC RESEZMMUKZVMVCAXHFASTEXCYPAYNHIZIUUHUIMZFUAYPZQSBOAXKCSGRRMMZGRHKEXBFCGGXVJTMUXN FTOLDYYWASPITKKCCSSGRUNCDCURWDRCNZVVGWEIURJDRCORSXDSQATHVXCLOSMTYCATXMEZGCVKVPCI LTKVRIRDOXEXZFCVKVPCSPOGRUXCUAXHVQSPYIVVVHMRGRUYSQTXSPZFMFIMMDZGZGXZJBCVKVPFWLGG RUKSYSGRKZJCRECFPBECUYGGSGNRSMZSTEXCDJHFEXEEYTYTNIICCNELYCXVGLJMEQSLTUVRIRCXVPFM SPEBIITHCAILVMCDMUVRGGCVKVPXCPRATKKCJIZMTDOLEBIITGSPKVJOOPEBIITGSPXIDZZCAJIIZJCR EWRDBRATHJDBLEXMEOVCHOWKJFWOLSLMGNEIMVNZGVKHKCSPEURRHCREUJUPGRSAWGZBBEJMEVGSNHIR HHFEKEIOVGSGZVMMQMGPCNHYGKMEVJYSZGFNAGCGVVIORHORBJTRHKVZQSPSUJSGCMDYTZGZCDHCRGZR

You are to write a program called {vigenereic.py} that takes as input the following Vigenre ciphertext:

GCMKGKRDBYTZLRORMTZLROGFEXIKCORSNSDZHFAZWLNCLIZIMZFWOTIPJIJOBIVQSPYURVTCSKTSNZJC RESEZMMUKZVMVCAXHFASTEXCYPAYNHIZIUUHUIMZFUAYPZQSBOAXKCSGRRMMZGRHKEXBFCGGXVJTMUXN FTOLDYYWASPITKKCCSSGRUNCDCURWDRCNZVVGWEIURJDRCORSXDSQATHVXCLOSMTYCATXMEZGCVKVPCI LTKVRIRDOXEXZFCVKVPCSPOGRUXCUAXHVQSPYIVVVHMRGRUYSQTXSPZFMFIMMDZGZGXZJBCVKVPFWLGG RUKSYSGRKZJCRECFPBECUYGGSGNRSMZSTEXCDJHFEXEEYTYTNIICCNELYCXVGLJMEQSLTUVRIRCXVPFM SPEBIITHCAILVMCDMUVRGGCVKVPXCPRATKKCJIZMTDOLEBIITGSPKVJOOPEBIITGSPXIDZZCAJIIZJCR EWRDBRATHJDBLEXMEOVCHOWKJFWOLSLMGNEIMVNZGVKHKCSPEURRHCREUJUPGRSAWGZBBEJMEVGSNHIR HHFEKEIOVGSGZVMMQMGPCNHYGKMEVJYSZGFNAGCGVVIORHORBJTRHKVZQSPSUJSGCMDYTZGZCDHCRGZR HUWVBSLEXECNOLDKQGZFMRYWFOVYTORXGCPYGRUOFGUSTYOVCYISLGRZEISDZHFESSDZBRAXCDVGREXW FAODRGGKDCLOLEUJHRHORBJTRHKIEYZCSYGIPSJTOIJQWQIZIUWMRHKMECOZIZEEOGMFURVXCPNKVFAH FIYTZSSJOTXYZGAAXGVGMBIYXZIUSIYLRWZCITLRWWRATXJJTQOSIFOVCRISIISPHUAWMSOUKRKOVCIX QZNILDKVJOOLDORXNVMWKEXZFRHKCRMSROQMCGCLEGRFOVCRNSNASPVKRKOVCIXLROFCDY

It is to implement/extend the following code which finds the key length:

def getKeyLength(ciphertext):

max_shift = -1

max_coinc = -1

for shift in range(1,15):

coinc_count = 0

for i in range(len(ciphertext)):

shifted_index = (i + shift) % len(ciphertext)

if ciphertext[i] == ciphertext[shifted_index]:

coinc_count += 1

print("Shift: {0}, Coincidences: {1}".format(shift, coinc_count))

if coinc_count > max_coinc:

max_shift = shift;

max_coinc = coinc_count

return (max_shift, max_coinc)

v_shift, v_coinc_count = getKeyLength(ciphertext)

print("v_shift: {0}, v_coinc_count: {1}".format(v_shift, v_coinc_count))

The code is then to find the key itself. its only output should be the key length and the key itself.

Further, it is to implement the given frequency vector, which contains the frequency of letters in the English language (the vector is already in alphabetical order; .082 for "A", .015 for "B". .028 for "C", etc); From these you can form the the A1, ..., A25 vectors. You will have to determine a way to translate ASCII codes to/from the range 0-25 (only the English alphabet is used).

EnglishFrequencies = [0.082, 0.015, 0.028, 0.043, 0.127, 0.022, 0.020, 0.061, 0.070, 0.002, 0.008, 0.040, 0.024, 0.067, 0.075, 0.019, 0.001, 0.060, 0.063, 0.091, 0.028, 0.010, 0.023, 0.001, 0.020, 0.001]

How would I find the key given the above information?? In a previous posting I included the code that found the key length which was returned as the answer to find the key & key length; this is a two part question, 1) finding key length, the code for which I have included, and 2) finding the key itself, by extending the given code within the given parameters which I'm struggling with. Simple and within the parameters is greatly appreciated; thank you.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle PL/SQL Programming Database Management Systems

Authors: Steven Feuerstein

1st Edition

978-1565921429

More Books

Students also viewed these Databases questions