Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For an upcoming Arduino project I need to generate, distribute and verify TANs (transaction authentication numbers).

Let me explain (and assume for a second this is happening on a bigger computer).
I need to verify some user input at varying times, coming from varying users. All I can distribute to them is TANs, ie. a list of 4 to 6 digit long "codes". Those cannot (and for safety reasons should not) be stored on the computer itself.

Thus I am seeking a practical method of generating a (or later, multiple) lists of TANs, with the possibility of verifying them against an ad-hoc generated list (later to be "forgotten" by the computer).

This is how it will play out (assuming there is such an algorithm):
I generate a "secret", ie. a number of x digits. I save this secret.
Using this "initial secret", I generate a list of n TANs.
I distribute the "secret" and the list of TANs, possibly not via the same channel (eg. one can be handed out, the other mailed later on).
The user, once he wishes to identify himself, enters his x digit secret.
The computer prompts for one of the TANs by it's location on the list (eg. "Enter TAN #17":).
The computer generates the whole list, based upon the secret in his RAM.
The computer verifies the user input against his generated list, in this example against entry #17.

I hope this clarifies my request which seems to me is a mathematical rather then a computer problem (specifically the reproducibility of the list based upon the x digit secret). If anyone has any pointers or ideas to share I'd be happy to read them.

Ok, apparently I was too tired yesterday - let me try to be more exact (actually, reading through the above I'm a bit embarrassed about myself...).
I am trying to find a pseudo random number generating algorithm that, given a 4 to 6 digit integer seed, produces a reproducible/repeatable sequence of 4 digit integers. If this can be deduced from an existing, known and trusted PRNG and if it doesn't need too much RAM (see, above, microcontrollers tend to be bit sparse on the RAM side, mostly) I'd be extra delighted.

share|cite|improve this question
Well any PRNG needs a seed, and a consistent seed given to a PRNG always gives a consistent sequence. Is this what you are asking for? – chubakueno May 21 '14 at 15:07
Yes, correct. Sorry, I wasn't really at ma best yesterday. I corrected my request above. – Christian May 22 '14 at 7:27

Your Answer


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

Browse other questions tagged or ask your own question.