用于处理hotp/totp(google authenticator)身份验证的轻量级python 2/3包。
SpookyOT的Python项目详细描述
恶作剧
totp/hotp(google authenticator)代码的轻量级python包
说明
这是一个轻量级的包,用于生成使用的totp和hotp代码。 用于双因素身份验证。它们可以与google authenticator一起使用 或者免费的。
一些特性(例如使用不同的散列算法或显示 超过6位)不适用于谷歌认证程序。
生成的uri(以及对它们进行编码的qr代码)遵循Google Authenticator format
示例
from spookyotp import (get_random_secret, TOTP, from_uri)
secret = get_random_secret(n_bytes=10)
totp = TOTP(secret, 'Example', 'user@example.org')
totp.save_qr_code('qr.png')
# you can now load the QR code with your app of choice
code = input("Enter code: ") # or raw_input in Python 2
matches = totp.compare(code)
if matches:
print("Correct!")
else:
print("Incorrect.")
# serialization and deserialization is supported via URI
uri = totp.get_uri()
new_totp = from_uri(uri)
为什么这么吓人?
我在万圣节创建了git repo,现在已经有了一个项目 叫小矮人。