1
0
Fork 0
asrc-dev/include/auth.py
Christian Damken 745c313fd5 - cleaned up auth-codes in class statuscodes
- added passwd_request() and passwd_reply() to class comm
- updated authentication process to fit protocol
- fixed version numbers for each *.py-file
2013-06-25 14:03:28 +02:00

37 lines
635 B
Python

# 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()