Пример #1
0
def encrypt_password(password, secret):
    h = hashlib.sha256()
    h.update(password)
    h.update(secret)
    return h.hexdigest()
Пример #2
0
def encrypt_password(password, secret):
    h = hashlib.sha256()
    h.update(isinstance(password, unicode) and password.encode('utf-8') or password)
    h.update(isinstance(secret, unicode) and secret.encode('utf-8') or secret)
    return h.hexdigest()
Пример #3
0
def encrypt_password(password, secret):
    h = hashlib.sha256()
    h.update(password.encode("utf-8"))
    h.update(secret.encode("utf-8"))
    return h.hexdigest()