During the first six months of 2019, more than 4 billion records were exposed by data breaches. Password hygiene is a top security priority. Researchers ranked the world's 100 worst passwords. Those passwords have been placed in the worst_passwords.txt file. You have been asked to write a program that can improve the hygiene of these terrible passwords.
It is common knowledge that if a password's length is less than 8 characters or if the password is a dictionary word that it is automatically considered weak. First, you are tasked with improving the hygiene of each password by doing the following:
* if the password is less than 8 characters, concatenate the string "3xPanD." to the end of the password
* if the password is a dictionary word, use list functions and methods to reverse all the characters in the word. You will find a list of all the dictionary words in the CROSSWD.txt file. (hint: consider using list, reverse, and join)
* if the password is less than 8 characters and a dictionary word, first concatenate the string "3xPanD." to the end of the password and then reverse the updated password.
After you have completed those steps, you then need to encrypt the passwords. In cryptography, a Caesar cipher is a very simple encryption technique in which each letter in the plain text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 3, the letter ’A’ would be replaced by ’D’, ’B’ would become ’E’, and so on. The method is named after Julius Caesar, who used it to communicate with his generals. ROT-13 ("rotate by 13 places") is a widely used example of a Caesar cipher where the shift is 13.
In Python, the key for ROT-13 may be represented by means of the following dictionary: key = { ’ a ’ : ’ n ’ , ’ b ’ : ’ o ’ , ’ c ’ : ’ p ’ , ’ d ’ : ’ q ’ , ’ e ’ : ’ r ’ , ’ f ’ : ’ s ’ , ’ g ’ : ’ t ’ , ’ h ’ : ’ u ’ , ’ i ’ : ’ v ’ , ’ j ’ : ’ w’ , ’ k ’ : ’ x ’ , ’ l ’ : ’ y ’ , ’m’ : ’ z ’ , ’ n ’ : ’ a ’ , ’ o ’ : ’ b ’ , ’ p ’ : ’ c ’ , ’ q ’ : ’ d ’ , ’ r ’ : ’ e ’ , ’ s ’ : ’ f ’ , ’ t ’ : ’ g ’ , ’ u ’ : ’ h ’ , ’ v ’ : ’ i ’ , ’w’ : ’ j ’ , ’ x ’ : ’ k ’ , ’ y ’ : ’ l ’ , ’ z ’ : ’m’ , ’A’ : ’ N’ , ’B’ : ’ O’ , ’C’ : ’ P’ , ’D’ : ’ Q’ , ’E ’ : ’ R’ , ’F ’ : ’ S ’ , ’G’ : ’ T’ , ’H’ : ’ U’ , ’ I ’ : ’ V’ , ’ J ’ : ’W’ , ’K’ : ’ X’ , ’L ’ : ’ Y’ , ’M’ : ’ Z ’ , ’N’ : ’ A’ , ’O’ : ’ B’ , ’P ’ : ’ C’ , ’Q’ : ’ D’ , ’R’ : ’ E’ , ’ S ’ : ’ F’ , ’T’ : ’ G’ , ’U’ : ’ H’ , ’V’ : ’ I ’ , ’W’ : ’ J ’ , ’X’ : ’ K’ , ’Y’ : ’ L ’ , ’Z ’ : ’M’ }. You will need to create this dictionary by reading the encryption protocol stored in the encrypt_protocol.txt file and create a dictionary that can be used for encrypted character lookup. Numbers will not be encrypted. After you have created the dictionary, write a function called encode that takes two arguments, a bad password (stored in your list from the first steps) and a key like the one above stored as a dictionary, and returns the encoded string. Use your function to assist you in writing out each improved and encrypted password out to the file improved_passwords.txt.
This needs to be in PYTHON. And im just having trouble figuring out how to make the encode function and then return it.