Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

I have two-factor authentication enabled on my Google account, and I have this app on my phone which generates a number I have to type when I'm logging in to Google-Mail.

But I don't understand how this number is validated on Google's side. My bank has a similar approach: they gave me this little gadget which also generates numbers.

How do such “authenticator number generators” work?

share|improve this question
7  
Here's a starting place for some research: Time-based One-time Password Algorithm, an extension of HOTP. What level of familiarity do you have with cryptography? That'll largely determine how detailed potential answers need to be. –  Reid Dec 3 '13 at 5:26

2 Answers 2

up vote 4 down vote accepted

Google (and other companies) have decided to enable one-time passwords for their 2-factor authentication as a step to improve password security. Here is the webpage that explains what Google is doing in more detail (including source code): https://code.google.com/p/google-authenticator/

In a nutshell, they implement two IETF RFCs, namely RFC 6238 and RFC 4226. Have a look at these two specifications; they contain all the details. I was the shepherd for RFC 6238.

share|improve this answer

I found the accepted answer above a bit unhelpful -- it basically just says: "read these two RFCs". So, on the theory that the quickest way to get the right answer to a question on the Internet is to provide a wrong one, and wait a few New York Minutes until someone corrects you, here's my attempt at a summary overview answer, based on a laughably cursory examination of the Wikipedia entry and the two RFCs.

basically your phone and the server app start by agreeing on a secret key, which they both know. that happens just once, when you set up the app on authenticator.

From there on in, the number that's generated every 30 seconds is based on SHA-1 hashing the secret key with the current time (in the form of a unix timestamp, rounded down to 30 seconds).

So, tl;dr: it's a hash of a shared secret with the current unix timestamp.

Or is it? Corrections welcomed...

share|improve this answer
1  
This answer might be correct (I don't know) but to be so, you should provide references to your claims: Where on wikipedia did you find it; Which RFCs etc –  figlesquidge Apr 28 at 15:13
    
Corrections welcomed... Huh? Don’t get me wrong, but you might want to check the accepted answer instead of guessing and asking to be corrected in case your guess is incorrect. In case something isn’t clear to you in relation to “two-factor authentication”, please feel invited to ask your own question. –  e-sushi Apr 28 at 17:01
    
sorry i wasn't very clear. have rephrased. basically i want a nice overview answer, not a "look at these two rfcs". –  hwjp Apr 28 at 18:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.