***DAILY CHALLENGE***: this one is about encryption & decryption. sounds complicated?!? Not this one ;)
TASK: write a function that get as input an ecnrypted text and a key (both strings) and outputs the decrypted text! input text: "#mpdgpuefzouquyyxzv#|#ypkerrzcovchvgjuwp#" let the program calculate and print the ouput. The '#' and '|' symbolize beginnig and end of string (don't use them in decryption)!!! EXTRA: use these functions to get the int value for a character (and vice versa): s = " abcdefghijklmnopqrstuvwxyz" function get_int(c): i = 0 while i < s.length(): if s[i] == c: return i print("ERROR") return -1 function get_char(i): while i < 0: i += s.length() i %= s.length() return s[i] ############################################ INFO: (you need to use One-Time-Pad & Cesar-Cipher) the key is encrypted the following way: msg = "hi" 1) OTP encryption (create a string size of msg. loop over key and msg and add their int values) random key = "zf" = 26 6, msg = "hi" = 8 9 --> encrypted text is: 26+8 6+9 = 34 15 = "go" ( = 7 15) 2) CESAR encryption (add to each int value (from char) the length of the key) only on key! key = "go" = 7 15 --> encrypted key is: 7+2 5+2 = 9 7 = "ig" now ouput is allways as follows: #key#|#txt# result: -----> "#ig#|#go#" (and 'nobody' knows what that means ^^) YOUR PART IS TO GO THE SAME WAY BACKWARDS MEANING: redo the cesar_cipher(- key.length) then redo the otp encryption by using get_char(key - encrypted) for all chars in key and encrypted Hope explanation is understandable ... if not check out my implementation: https://code.sololearn.com/cgq1RmKzNmlN/#py GOOD LUCK CODERS!!! If this one is too complicated try another one: -- will be uploaded soon --