I got one of those PayPal security keys a little while ago.
I got one after hearing about it from the
security now podcast. Now I use it for PayPal and
Verisign's OpenID.
Since it is based off of cryptographic algorithms. I decided to start using it for random numbers whenever I needed one. I do this all the time. Flip a coin? I don't carry change, but I have my security key, so just pick even/odd and the number it shows is randomly even or odd. Pick a number from 1-10, whip out my security key and pick a digit.
After doing this for a while I noticed that the first digit didn't seem very random. So, I sat down with a pencil and paper and pressed my security key every thirty seconds for about a twenty minutes. I wrote down all the numbers and every first digit is one larger than the previous. (mod ten)
After thinking about why they would do this, it made perfect sense. They have a clock in them, that doesn't stay exactly sync'd with the server. when they check your key, they have to check it with several numbers on either side of the time it should be and see which one of them it is, then update their sync offset. This way, if it already know what the key's clock is within 5 minutes, the key gives them the final detail about which 30 second slot it is at. The server checks the first digit, calculates the number for that time slot and compares the result. If it is incorrect, it can check the next 5 minutes on either side of the expected one. that way it can check a 15 minute range with only 3 cryptographic calculations instead of 30.
This prompted a question as to whether I could predict the number of the first digit.
First I had to find out exactly how long it waits before changing the number. So, I periodicly wrote down the time the number switched (within 5 seconds) and the first digit. I entered these into
a spreadsheet. The initial results showed about 31.965 seconds. But as I went longer it came closer to 32 seconds even.
After that It was simply a matter of adjusting for the difference in comuter time and my watch's time. (I wrote them down according to my watch)