Passwords for files
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from datetime import datetime
|
||||
import secrets
|
||||
import string
|
||||
import passlib.hash
|
||||
|
||||
VALID_TOKEN_CHARS = string.digits + string.ascii_letters
|
||||
|
||||
@@ -29,3 +30,11 @@ def file_size_human(num, HTML=True):
|
||||
|
||||
def file_size_MB(num):
|
||||
return "{:,.2f}".format(num / (1024 * 1024))
|
||||
|
||||
|
||||
def hash_password(password):
|
||||
return passlib.hash.argon2.hash(password)
|
||||
|
||||
|
||||
def verify_password(password, hash):
|
||||
return passlib.hash.argon2.verify(password, hash)
|
||||
|
||||
Reference in New Issue
Block a user