Skip to content

Instantly share code, notes, and snippets.

@Akanoa
Created August 29, 2022 19:09
Show Gist options
  • Save Akanoa/cd12bad0adda1c590a91ef5232e37b9a to your computer and use it in GitHub Desktop.
Save Akanoa/cd12bad0adda1c590a91ef5232e37b9a to your computer and use it in GitHub Desktop.
double hmac
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