TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How do authenticator apps work?

2 点作者 rbrown超过 1 年前
Does anyone know how 2 factor authenticator services work? I'm curious how it's possible for the services reading them and the services creating them to predictably know the exact digit sequence at a given time without being knowable to 3rd parties. From an cursory undergraduate CS education it feels like a related but different problem to hash functions. Just curious!

4 条评论

jqpabc123超过 1 年前
Each party (sender and receiver) share a secret, random key. This key is created and shared only once during the initial account setup.<p>Thereafter, this secret key is used by both sender and receiver to encrypt the current time and produce a hash code.<p>If the codes match and your login credentials are valid (2 factors), you are authenticated; otherwise, you are not.<p>Once you dig into it, it&#x27;s not too hard to replicate. I wrote myself a simple desktop CLI program that duplicates the app on my phone. It retrieves the appropriate secret key (selected by key&#x2F;name) from an encrypted data file and generates a code as needed and places it into the clipboard so I can easily paste into a login screen.
评论 #37683303 未加载
cyb0rg0超过 1 年前
You click, tap and hope like hell, for the magic to happen
nancyp超过 1 年前
Most authenticator apps use TOTP or HOTP algorithms to generate tokens against a shared secret. Look up these algorithms to see more.
pestatije超过 1 年前
they sync with time
评论 #37676944 未加载