salt the hashes

This commit is contained in:
Ville Rantanen
2018-02-27 18:53:56 +02:00
parent 09bdb028dd
commit 9ed8c18fb3
4 changed files with 7 additions and 7 deletions

View File

@@ -44,11 +44,13 @@ def get_direct_token(share, filename):
)
def password_hash(string):
def password_hash(string, salt=""):
if type(string) == str:
string = string.encode("utf-8")
if type(salt) == str:
salt = salt.encode("utf-8")
return hashlib.sha1(
string
string+salt
).hexdigest()

View File

@@ -1,5 +1,4 @@
import os
import hashlib
from datetime import datetime
from flask import current_app as app