# includes/auth.py # # module version: 1.0.20130625 # for protocol version 0.2.20130625 # # # contains: # init() # check_passwd() # mkpasswd() # import hashlib class auth: passwd = "" def init(password): global passwd passwd = password def check_passwd(incpass): """ checks a given password """ if hashlib.sha512(incpass).hexdigest() == passwd: return True else: return False def mkpasswd(incpass): """ encodes a password with SHA512 """ return hashlib.sha512(incpass).hexdigest()