Skip to content

Commit 99fd732

Browse files
Generate hmac signature
1 parent 8155b0d commit 99fd732

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pydatastructs/graphs/graph.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ def get_secret_key():
1717
secret_key = os.getenv("HMAC_SECRET_KEY")
1818
if secret_key is None:
1919
raise RuntimeError("Secret key is missing!")
20-
return secret_key.encode()
20+
return secret_key.encode()
21+
def generate_hmac(data):
22+
"""Generating HMAC signature for integrity verification"""
23+
return hmac.new(get_secret_key(), data.encode(),hashlib.sha256).haxdigit()
2124
__all__ = [
2225
'Graph'
2326
]

0 commit comments

Comments
 (0)