Skip to content

Instantly share code, notes, and snippets.

@richvdh
Created September 29, 2016 21:44
Show Gist options
  • Save richvdh/e7aca9c2c867fa7fe33b9b32071ab839 to your computer and use it in GitHub Desktop.
Save richvdh/e7aca9c2c867fa7fe33b9b32071ab839 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import hashlib
import hmac
user = "esouvbh"
password = "souvik"
admin = False
key="shared_secret"
mac = hmac.new(
key=key,
digestmod=hashlib.sha1,
)
mac.update("esouvbh")
mac.update("\x00")
mac.update("souvik")
mac.update("\x00")
mac.update("admin" if admin else "notadmin")
print mac.hexdigest()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment