News for hackers. Stuff that matters.
Re:Behind the 6-digit code: Building HOTP and TOTP from scratch by yuliyp on Monday April 14, 2025 @11:09PM (#43688638)
Facebook's login/account recovery codes are not TOTP/HOTP, but are random numbers. Also, the author struggled to check their implementation. One can easily compare an implementation of many websites by grabbing the QR codes they use for login and importing into your favorite authenticator app and also decoding the QR code to get the secret. In theory your code should produce the same codes at the same time as the app.
Re:Behind the 6-digit code: Building HOTP and TOTP from scratch by dogacel on Tuesday April 15, 2025 @12:10AM (#43688903)
Hi,

> Also, the author struggled to check their implementation. One can easily compare an implementation of many websites by grabbing the QR codes they use for login and importing into your favorite authenticator app and also decoding the QR code to get the secret.

Can you clarify this? It's been some time since I have written the code, AFAIK it was working fine. Did you see any discrepencies when you tested the implementation against a real authenticator app?

Re:Behind the 6-digit code: Building HOTP and TOTP from scratch by yuliyp on Tuesday April 15, 2025 @10:50AM (#43693575)
I was responding to the statement at the bottom of the article: "however I have struggled to find a website that help me check my implementation as their secret-key representations were not standardized. Thus, I have published my own short demo app to showcase." The Google Authenticator QR codes end up being a fairly standardized secret key representation.
Re:Behind the 6-digit code: Building HOTP and TOTP from scratch by dogacel on Tuesday April 15, 2025 @10:58AM (#43693705)
Even though QR codes are standardized, the original RFCs do not use QR codes. That's what I tried to mean, you can't find apps that use plain-text secrets.
Re:Behind the 6-digit code: Building HOTP and TOTP from scratch by Erikun on Tuesday April 15, 2025 @05:22AM (#43690655)
Both RFC:s have test vectors you can use to write tests as well.