Skip to content

Instantly share code, notes, and snippets.

@evandrix
Created January 10, 2013 08:02
Show Gist options
  • Save evandrix/4500317 to your computer and use it in GitHub Desktop.
Save evandrix/4500317 to your computer and use it in GitHub Desktop.
# Kevin L. Stern, June 2012.
from hashlib import sha256
from hmac import new as hmac
from getpass import getpass
from base64 import b64encode
master = getpass('Enter your master password: ')
account = raw_input('Enter the account name: ')
iterations = 100000
secret = sha256(master + account + str(iterations)).digest()
for j in xrange(iterations-1):
secret = sha256(master + secret).digest()
print b64encode(hmac(secret, account, sha256).digest())
raw_input('Press [Enter] to continue.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment