1
0
Fork 0
asrc-dev/include/auth.py

32 lines
658 B
Python
Raw Normal View History

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