Trusted by 2+ million users, 1000+ happy students everyday
Showing pages 1 to 2 of 5 pages
Instructions:We will be extending the Caesar cypher we looked at earlier into a full-fledged password saver. The program will be able to:Lookup passwords for websitesAdd new passwords for websites (encrypting them with the caesar cypher)Store these passwords to a file on the computerLoad passwords from a stored password fileMost of the code is provided but there are some critical components missing. You will need to add these components.A first draft is due at the end of Week 6. This is your opportunity to get feedback and support on this assignment. I do not expect your first submission to work, you will receive credit for any significant attempt. The final version is due at the end of Week 7. Week 7 ends on a Friday, so don't wait untilthe last minute!Create a python file called PasswordSaver.py in PyCharm and copy the following code into it.Extra Credit (max 5 points): Add additional menu items to the program. For instance, add the ability to delete passwords.Provided code:import csvimport sys#The password list - We start with it populated for testing purposespasswords =[["yahoo","XqffoZeo"],["google","CoIushujSetu"]]#The password file name to store the passwords topasswordFileName ="samplePasswordFile"#The encryption key for the caesar cypherencryptionKey=16#Caesar Cypher Encryptiondef passwordEncrypt (unencryptedMessage, key):#We will start with an empty string as our encryptedMessage encryptedMessage =''
#For each symbol in the unencryptedMessage we will add an encrypted symbol into the encryptedMessagefor symbol in unencryptedMessage:if symbol.isalpha(): num = ord(symbol) num += keyif symbol.isupper():if num > ord('Z'): num -=26elif num < ord('A'): num +=26elif symbol.islower():if num > ord('z'): num -=26elif num < ord('a'): num +=26 encryptedMessage += chr(num)else: encryptedMessage += symbolreturn encryptedMessagedef loadPasswordFile(fileName):with open(fileName, newline='')as csvfile: passwordreader = csv.reader(csvfile) passwordList = list(passwordreader)return passwordListdef savePasswordFile(passwordList, fileName):with open(fileName,'w+', newline='')as csvfile: passwordwriter = csv.writer(csvfile) passwordwriter.writerows(passwordList)
Found this document preview useful?
You are reading a preview Upload your documents to download or Become a Desklib member to get accesss