We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 48cc12d + 5cdf952 commit 91c5549Copy full SHA for 91c5549
canaille/app/__init__.py
@@ -1,5 +1,6 @@
1
import base64
2
import hashlib
3
+import hmac
4
import json
5
import re
6
from base64 import b64encode
@@ -20,10 +21,9 @@ def b64_to_obj(string):
20
21
22
23
def build_hash(*args):
- return hashlib.sha256(
24
- current_app.config["SECRET_KEY"].encode("utf-8")
25
- + obj_to_b64(str(args)).encode("utf-8")
26
- ).hexdigest()
+ key = current_app.config["SECRET_KEY"].encode("utf-8")
+ message = obj_to_b64(str(args)).encode("utf-8")
+ return hmac.new(key, message, hashlib.sha256).hexdigest()
27
28
29
def default_fields():
0 commit comments