fix(starpost): bound authentication memory
This commit is contained in:
1 parent
393e7a13f4
commit
b4870b401a
4 files changed
+50
-4
No files matched your search
@@ -0,0 +1,16 @@
|
||||
from werkzeug.security import check_password_hash, generate_password_hash
|
||||
|
||||
|
||||
# Werkzeug's default scrypt hash needs about 32 MiB of working memory per
|
||||
# concurrent request. The API serves up to four authentication requests at a
|
||||
# time, so use a CPU-bound hash for new accounts while retaining verification
|
||||
# support for existing scrypt hashes.
|
||||
PASSWORD_HASH_METHOD = "pbkdf2:sha256:600000"
|
||||
|
||||
|
||||
def hash_password(password):
|
||||
return generate_password_hash(password, method=PASSWORD_HASH_METHOD)
|
||||
|
||||
|
||||
def password_matches(password_hash, password):
|
||||
return check_password_hash(password_hash, password)
|
||||
Reference in new issue
Block a user