mirror of https://github.com/kianby/stacosys
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
313 B
Python
17 lines
313 B
Python
10 years ago
|
#!/usr/bin/python
|
||
|
# -*- coding: UTF-8 -*-
|
||
|
|
||
|
import hashlib
|
||
7 years ago
|
from conf import config
|
||
10 years ago
|
|
||
|
|
||
|
def salt(value):
|
||
6 years ago
|
string = "%s%s" % (value, config.get(config.SECURITY_SALT))
|
||
10 years ago
|
dk = hashlib.sha256(string.encode())
|
||
|
return dk.hexdigest()
|
||
|
|
||
|
|
||
|
def md5(value):
|
||
|
dk = hashlib.md5(value.encode())
|
||
|
return dk.hexdigest()
|