blob: 6796bbd66f82a15642bcae85985e60c2983da9a7 [file] [log] [blame]
Jakub Josefd8e04292016-11-28 18:02:27 +01001import hashlib
2import random
3import string
4
5def encode_password(password):
6 salt = ''.join(random.SystemRandom().choice(string.ascii_letters)
7 for i in range(6))
8 hash_ = hashlib.sha256("%s{%s}" % (password, salt)).hexdigest()
9 return "%s:%s" % (salt, hash_)