aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2020-08-27 01:32:34 +0300
committerBonfaceKilz2020-08-27 01:42:46 +0300
commit46443ec8d2cdfd7c60358a889d90a90e4f7daaf4 (patch)
tree6cad69810a0ea027a0db033f34ce4c1c949c2226
parent869da13b92e70fa0769cd1a49e15b03e2c9d0550 (diff)
downloadgenenetwork2-46443ec8d2cdfd7c60358a889d90a90e4f7daaf4.tar.gz
Replace string arguments to "hmac.new" with bytearray
See: <https://stackoverflow.com/questions/31848293/python3-and-hmac-how-to-handle-string-not-being-binary>
-rw-r--r--wqflask/utility/hmac.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/wqflask/utility/hmac.py b/wqflask/utility/hmac.py
index 73e28790..aa21c741 100644
--- a/wqflask/utility/hmac.py
+++ b/wqflask/utility/hmac.py
@@ -10,7 +10,7 @@ def hmac_creation(stringy):
secret = app.config['SECRET_HMAC_CODE']
- hmaced = hmac.new(secret, stringy, hashlib.sha1)
+ hmaced = hmac.new(bytearray(secret, 'utf8'), bytearray(stringy, 'utf8'), hashlib.sha1)
hm = hmaced.hexdigest()
# ZS: Leaving the below comment here to ask Pjotr about
# "Conventional wisdom is that you don't lose much in terms of security if you throw away up to half of the output."