用于处理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,现在已经有了一个项目 叫小矮人。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
返回数组无效的java方法   异步Java CompletableFuture获取其请求   java是否可以像RDBMS那样使用视图?   java如何在屏幕上只运行一个片段?   java无法从Vertex jdbc查询中获取结果   java从jtable获取对象的正确方法   java Spring 3数据设备替代方案   Java BigDecimal:四舍五入到客户首选的数字和增量   JAVA主窗口没有出现,我必须左键单击主窗口。java并单击run查看它   Eclipse RCP中的java进程自定义设备事件   JavaEclipse一次又一次地构建代码(没有任何更改)?   java如何实现对象合并