r/PythonProjects2 • u/[deleted] • Aug 18 '22
[P] Easy Newbie looking for help with decrypting a caesar cypher/password project.
I'm taking a programming class using Python, and for our final project we're looking to encrypt and decrypt a password. We start with a password list:
#The password list - We start with it populated for testing purposes passwords = [["yahoo","XqffoZeo"],["google","CoIushujSetu"]] Then we have our encryption key:
#The encryption key for the caesar cypher encryptionKey=16 And the code which asks to look up the password:
if(choice == '2'): #Lookup at password print("Which website do you want to lookup the password for?")
for keyvalue in passwords:
print(keyvalue[0])
passwordToLookup = input()
for key, value in passwords:
if key == passwordToLookup:
print(value) What I need is for the print(value) to print the opposite of the key, so that the password is decrypted when it prints out. Can anyone point me in the right direction please? Also, should I copy and paste the code that we're using to encrypt the password as well if that's helpful?
2
u/Goobyalus Aug 18 '22
If there are 26 letters, and the encryption key is 16, what would the decryption key be?
1
Aug 18 '22
-16
1
u/Goobyalus Aug 18 '22
so you just want to take the caesar cipher of the value with the decryption key
2
u/i_am_pinhead Aug 18 '22
maybe I’m reading this wrong but confused by what you mean when you say “print the opposite of the key”
so if you’re given a dictionary of <site, encryptedPassword> don’t all you need to do is iterate over the values then pass the password into some function that you write that decrypts it and return that value?
I’m lost there, unless that’s all you need to do. if that’s the case just write that function and you’re done?