gpt4 book ai didi

TOTP : Do the seconds count?

转载 作者:行者123 更新时间:2023-12-05 03:05:22 24 4
gpt4 key购买 nike

在设备上:如果现在生成 TOTP,它会持续到最后几秒还是四舍五入到最接近的 00?

例如,如果我在 22hr:30m​​:2s:33ms 生成一个 TOTP(在 UTC 中检查),它是否四舍五入为 22hr:30m​​:0s:00ms 然后生成?

我有这个问题是因为,如果我要在 22hr:30m​​:2s:33ms 生成一个 TOTP 并且如果服务器要在 22hr:30m​​:6s:40ms 验证它,totp 会不会不同?即使我们使用 3 个步骤,每个步骤 30 秒,我们不会错过 22hr:30m​​:2s:33ms 停止吗?

我想我错过了这里的要点。

最佳答案

这是使用 Javascript 对其进行舍入的方式

var time = leftpad(dec2hex(Math.floor(epoch / 30)), 16, '0');

所以你问的是这部分“Math.floor(epoch/30)”的答案,意思是OTP在12:22:30、12:22:37、12:22生成:39 .... 12:22:59 完全一样

关于TOTP : Do the seconds count?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51053753/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com