User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
notes:python_google_authenticator_generator [2013/04/02 13:10]
notes:python_google_authenticator_generator [2013/04/02 13:32] (current)
Line 22: Line 22:
 def get_totp_token(secret):​ def get_totp_token(secret):​
     return get_hotp_token(secret,​ intervals_no=int(time.time())//​30)     return get_hotp_token(secret,​ intervals_no=int(time.time())//​30)
 +Until I get chance to put it somewhere else, here's an unrelated snippet to generate fairly secure keys from pycrypto:
 +<code python>
 +>>>​ import Crypto.Hash.SHA256
 +>>>​ import Crypto.Protocol.KDF
 +>>>​ myprf = lambda p,s:,​ s, Crypto.Hash.SHA256).digest()
 +>>>​ Crypto.Protocol.KDF.PBKDF2("​password",​ "​salt",​ dkLen=32, count=5000, prf=myprf)
 </​code>​ </​code>​
notes/python_google_authenticator_generator.1364904642.txt.gz ยท Last modified: 2013/04/02 13:10 by andy