Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- username = input("Enter your username: ")
- password = input("Enter your password: ")
- #hashing
- p = len(password)+3
- hashValue = 0
- for element in password:
- hashValue += ord(element)*(37**(p*3+2))
- p += 1
- #file reading
- searchfile = open("users.txt","r")
- for line in searchfile:
- if username in line:
- print(line)
- passwordFile = searchfile.readline()
- print(passwordFile)
- if password == passwordFile:
- print("Succesfully logged in.")
- else:
- print("Denied.")
- user1
- 5682064547402171341935718587051072007223952507159509922486300727280224437681256157289392848984758601859653014989196589
- user2
- 5459242799619652684746638604361187538149455998072046842553294309854609933784480688770064676790163754304952120716010653
- upD = {}
- with open ("users.txt") as f:
- for line in f:
- (key,val) = line.split()
- upD[key] = val
- print(upD)
- if password in upD[username]:
- print("Welcome.")
- else:
- print("Denied.")
- user1 5682064547402171341935718587051072007223952507159509922486300727280224437681256157289392848984758601859653014989196589
- user2 5459242799619652684746638604361187538149455998072046842553294309854609933784480688770064676790163754304952120716010653
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement