Created
August 29, 2022 19:09
-
-
Save Akanoa/cd12bad0adda1c590a91ef5232e37b9a to your computer and use it in GitHub Desktop.
double hmac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def verify(self, secret): | |
identifier = bytes(self.identifier, encoding="utf-8") | |
secret = bytes(secret, encoding="utf-8") | |
signature = hmac_sha256(secret, identifier) | |
for caveat in self.caveats: | |
signature = hmac_sha256(signature, caveat.encode("utf-8")) | |
if hmac_sha256(signature, self.signature) == hmac_sha256(signature, signature): | |
print("Macaron valide") | |
else: | |
print("Macaron invalide") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment