[Django]-Is there an equivalent of PHP's hash_hmac in Python/Django?

59👍

You want hmac.

hmac.new("sharedpassword", "12345", hashlib.sha256).hexdigest()

or in python 3:

hmac.new(bytes("sharedpassword", 'UTF-8'), "12345".encode(), hashlib.sha256).hexdigest()
👤Amber

Leave a comment