Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#PROBLEM: Do Caesar Encryption/Decryption, including cracking a string w/ ## unknown Caesar key. ## ##Functions needed: ## Encrypt(string_text, int_key): Takes a string and integer key,

#PROBLEM: Do Caesar Encryption/Decryption, including cracking a string w/ ## unknown Caesar key. ## ##Functions needed: ## Encrypt(string_text, int_key): Takes a string and integer key, returns ## the encryption of the string using that key. Note that for Caesar encryption, ## an encryption with key k (k in 1 - 25) is decrypted by doing the same process ## with key 26-k. Returns encrypted string using specified key. ## ## Decrypt(string_text, int_key): Decrypts key by calling Encrypt with key ## 26-int_key and returning the result. Done this way to make for a cleaner ## breakdown of the problem. Returns decrypted string using specified key. ## ## Crack(string_text): Decrypts a string by repeatedly calling Decrypt with each ## possible key (1 to 25) and remembering the one with a letter frequency ## closest to English based on counts of E, T, O, A, I, N. Returns tuple: ## decrypted string and decryption key. ## ## Get_input(): Interacts with user, gets user choice of '1'-'4' and returns that ## value. If user enters anything else, prints brief error message and tries again. ## ## Print_menu(): Prints menu. No user interaction. ################################ import string def Encrypt(string_text, int_key) -> str: '''Caesar-encrypts string using specified key.''' def Decrypt(string_text, int_key) -> str: ''' Decrypts Caesar-encrypted string with specified key. ''' def Get_input()->str: '''Interacts with user. Returns one of: '1', '2', '3', '4'.''' def Print_menu(): '''Prints menu. No user interaction. ''' def main(): # our entire program: main() 

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

Oracle9i Database Administrator Implementation And Administration

Authors: Carol McCullough-Dieter

1st Edition

0619159006, 978-0619159009

More Books

Students also viewed these Databases questions