The assignment is to create a program that encrypts and saves passwords, allowing users to add, view, and save passwords to a file. The program should have the following functions: adding passwords with encryption, saving the passwords to a file, viewing all passwords in the list, and quitting the program.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
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 websites ï‚·Add new passwords for websites (encrypting them with the caesar cypher) ï‚·Store these passwords to a file on the computer ï‚·Load passwords from a stored password file Most 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: importcsv importsys #Thepassword list - Westartwithit populatedfor testingpurposes passwords=[["yahoo","XqffoZeo"],["google","CoIushujSetu"]] #Thepassword file nameto store the passwordsto passwordFileName="samplePasswordFile" #Theencryption key forthe caesarcypher encryptionKey=16 #Caesar Cypher Encryption defpasswordEncrypt(unencryptedMessage,key): #We will start with anemptystringas our encryptedMessage encryptedMessage=''
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
#Foreach symbolin theunencryptedMessage we will add an encrypted symbol into the encryptedMessage forsymbolinunencryptedMessage: ifsymbol.isalpha(): num=ord(symbol) num+=key ifsymbol.isupper(): ifnum> ord('Z'): num-=26 elifnum< ord('A'): num+=26 elifsymbol.islower(): ifnum> ord('z'): num-=26 elifnum< ord('a'): num+=26 encryptedMessage+=chr(num) else: encryptedMessage+=symbol returnencryptedMessage defloadPasswordFile(fileName): withopen(fileName,newline='')ascsvfile: passwordreader=csv.reader(csvfile) passwordList=list(passwordreader) returnpasswordList defsavePasswordFile(passwordList,fileName): withopen(fileName,'w+',newline='')ascsvfile: passwordwriter=csv.writer(csvfile) passwordwriter.writerows(passwordList)
whileTrue: print("Whatwouldyou like todo:") print(" 1.Open password file") print(" 2.Lookupa password") print(" 3.Add apassword") print(" 4.Save password file") print(" 5.Printthe encrypted password list (for testing)") print(" 6.Quit program") print("Please enter a number(1-4)") choice=input() if(choice=='1'):#Loadthe password listfroma file passwords=loadPasswordFile(passwordFileName) if(choice=='2'):#Lookup atpassword print("Which website doyou want tolookup thepassword for?") forkeyvalueinpasswords: print(keyvalue[0]) passwordToLookup=input() ####### YOUR CODEHERE###### #Youwill need tofindthe passwordthatmatches thewebsite #Youwill then need todecrypt thepassword # #1. Createa loopthatgoes througheachitem in thepassword list #You canconsult https://champlain.instructure.com/courses/486659/pages/working-with-lists? module_item_id=8842667 #simplestway to loopthrough a list is: fori in range(len(NAMEOFLIST)) # #2. Check if thename is found.Toindexa list of lists you use2 square backet sets #So passwords[0][1]wouldmean for thefirstitemin thelistget it's 2nd item(remember, lists start at 0) #So thiswouldbe 'XqffoZeo' inthe passwordlistgivenwhat is predefined at the topof thepage. #If youcreated a loop using thesyntax describedin step 1, then iis your 'iterator'in thelistso you #will want touse iin your first setof brackets.
# #3. If thename is found thendecrypt it.Decryptingis that exact reverse operation from encrypting.Take alook at the # caesar cypher lectureas areference.You donot need towriteyourown decryptionfunction, you canreusepasswordEncrypt # #Write the above onestep at a time.By thisI mean, write step 1...but in your loop print outeveryitem in thelist #for testing purposes.Then write step2, and print outthe passwordbut not decrypted.Then write step 3.Thisway #you cantest easilyalongthe way. # ####### YOUR CODEHERE###### if(choice=='3'): print("Whatwebsite isthis password for?") website=input() print("Whatis the password?") unencryptedPassword=input() ####### YOUR CODEHERE###### #Youwill need toencrypt thepassword and store it in thelist of passwords #Theencryption function is alreadywritten foryou #Step1: You cansay encryptedPassword = passwordEncrypt(unencryptedPassword,encryptionKey)] #theencryptionKey variable is defined alreadyas 16,don'tchange this #Step2: create alistof size 2, first item the website name andthe second itemthe password. #Step3: append the list fromStep2 to the passwordlist ####### YOUR CODEHERE###### if(choice=='4'):#Savethe passwords toa file savePasswordFile(passwords,passwordFileName)
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
if(choice=='5'):#print outthe passwordlist forkeyvalueinpasswords: print(', '.join(keyvalue)) if(choice=='6'):#quitour program sys.exit() print() print() Grading Rubric: PasswordSaver PasswordSaver CriteriaRatingsPts Program Specifications / Correctness view longer description Exceeds; No errors, program always works correctly and meets the specifications. 60.0pts Meets; Minor details of the program specification are violated, program functions incorrectly for some inputs. 42.5pts Nearly Meets; Significant details of the specification are violated, program often exhibits incorrect behavior. 37.5pts Does Not Meet; Program only functions correctly in very limited cases or not at all. 30.0pts 60.0pt Readability view longer description Exceeds; No errors, code is clean, understandable, and well- organized. 30.0pts Meets; Minor issues with consistent indentation, use of whitespace, variable naming, or general organization. 17.0pts Nearly Meets; At least one major issue with indentation, whitespace, variable names, or organization. 15.0pts Does Not Meet; Major problems with at least three or four of the readability subcategories. 12.0pts 30.0pt Assignment Specificiations view longer description Exceeds; No Errors 10.0pts Meets; One or two minor details of the assignment specification are violated, such as instructions slightly misunderstood. 4.25pts Nearly Meets; Multiple minor details of the assignment specification are violated. 3.75pts Does Not Meet; Significant details of the specification are violated, such as extra instructions ignored or entirely misunderstood. 3.0pts 10.0pt Total Points:100.0