user.py 620 B

123456789101112131415161718192021
  1. import hashlib
  2. '''
  3. User Class for storing all the application users, including some helper functions
  4. which could be needed in later development
  5. '''
  6. class User:
  7. def __init__(self, uname, pword, ar=1001):
  8. self.username = uname
  9. self.ar = ar
  10. self.SALT = 'SALTERINO' # doest really matter that much
  11. self.pwhash = hashlib.sha256(pword + self.SALT).hexdigest()
  12. self.flag = ""
  13. def __str__(self):
  14. if self.flag != "":
  15. return '%s:%s:%d:%s' %(self.username, self.pwhash, self.ar,self.flag)
  16. return '%s:%s:%d:' %(self.username, self.pwhash, self.ar)