The purpose of this question is to implement Sage functions for encryption/decryption with the Caesar cipher, as well as attacks. You will need to submit
The purpose of this question is to implement Sage functions for encryption/decryption with the Caesar cipher, as well as attacks. You will need to submit the implementation along with screenshots of running the implementation of the functions.
Implement Sage encryption/decryption functions that take a key (as an integer in 0, 1,2, , 25), and a string. The function should only operate on the characters a, b, z (both upper and lower case), and it should leave any other characters, unchanged.
Implement a function that performs a brute force attack on a ciphertext, it should print a list of the keys and associated decryptions. It should also take an optional parameter that takes a substring and only prints out potential plaintexts that contain that decryption.
Show the output of your encrypt function (part a) on the following (key, plaintext) pairs:
k = 6 plaintext = "Get me a vanilla ice cream, make it a double."
k = 15 plaintext = "I don't much care for Leonard Cohen."
k = 16 plaintext = "I like root beer floats."
Show the output of your decrypt function (part a) on the following (key, ciphertext) pairs:
k = 12 ciphertext = 'nduzs ftq buzq oazqe.'
k = 3 ciphertext = "fdhvdu qhhgv wr orvh zhljkw."
k = 20 ciphertext = "ufgihxm uly numnys."
Show the output of your attack function (part c) on the following ciphertexts, if an optional keyword is specified, pass that to your attack function:
ciphertext = 'gryy gurz gb tb gb nzoebfr puncry.' keyword = 'chapel'
ciphertext = 'wziv kyv jyfk nyve kyv tpdsrcj tirjy.' keyword = 'cymbal'
ciphertext = 'baeeq klwosjl osk s esf ozg cfwo lgg emuz.' no keyword
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started