123456789101112131415161718192021 |
- import hashlib
- '''
- User Class for storing all the application users, including some helper functions
- which could be needed in later development
- '''
- class User:
- def __init__(self, uname, pword, ar=1001):
- self.username = uname
- self.ar = ar
- self.SALT = 'SALTERINO' # doest really matter that much
- self.pwhash = hashlib.sha256(pword + self.SALT).hexdigest()
- self.flag = ""
- def __str__(self):
- if self.flag != "":
- return '%s:%s:%d:%s' %(self.username, self.pwhash, self.ar,self.flag)
- return '%s:%s:%d:' %(self.username, self.pwhash, self.ar)
|