-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassword.py
More file actions
33 lines (27 loc) · 917 Bytes
/
Copy pathpassword.py
File metadata and controls
33 lines (27 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from hashlib import * # * means to import all
def hash(password):
return sha256(password.encode('utf-8')).hexdigest()
username = input("What's your username? ")
inventory = {}
done = True
if username in inventory:
password = input("What's your password? ")
if inventory[username] == hash(password):
print("You're in!")
elif not username in inventory:
print("Incorrect username. You are not signed up yet. ")
password = input("Please enter a password.")
hash(password)
inventory[username] = hash(password)
print("You are able to login now with the following username: " + username)
print(inventory)
while done:
username = input("What's your username? ")
if username in inventory:
password = input("What's your password? ")
if inventory[username] == hash(password):
print("You're in!")
done = False
elif inventory[username] != hash(password):
print("You're not in!")
done = True