From 8085e0031efa4b0b0a1a0e11a24f30b65c5db510 Mon Sep 17 00:00:00 2001 From: Artem Andreev Date: Sun, 3 Feb 2013 22:14:32 +0400 Subject: [PATCH] Password should be encoded as 'utf-8' before creating hmac to support passwords with non-latin symbols --- flask_security/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask_security/utils.py b/flask_security/utils.py index 66d0f57..7397ab4 100644 --- a/flask_security/utils.py +++ b/flask_security/utils.py @@ -78,7 +78,7 @@ def get_hmac(password): 'must not be None when the value of `SECURITY_PASSWORD_HASH` is ' 'set to "%s"' % _security.password_hash) - h = hmac.new(_security.password_salt, password, hashlib.sha512) + h = hmac.new(_security.password_salt, password.encode('utf-8'), hashlib.sha512) return base64.b64encode(h.digest())