· 7 years ago · Oct 15, 2018, 06:34 PM
1def get_hexdigest(salt, plaintext):
2 return sha256(salt + plaintext).hexdigest()
3
4SECRET_KEY = 's3cr3t'
5
6def make_password(plaintext, service):
7 salt = get_hexdigest(SECRET_KEY, service)[:20]
8 hsh = get_hexdigest(salt, plaintext)
9 return ''.join((salt, hsh))