import hashlib def hash_password(access_code): """Hash a password for storing.""" sha256 = hashlib.sha256() sha256.update(access_code.encode('utf-8')) return sha256.hexdigest() def login(access_code): hashed_code = hash_password(access_code) with open("hashed_codes.txt") as file: for line in file: if hashed_code in line: return True return False