I'm pretty sure there are famous algorithms for my problem, but I don't have enough knowledge in this field, so I need your lights.
Here si the problem :
- Alice sends key X to Bob.
- Bob has an function that given the key X and the time, generates a key Y every 30 seconds, which is valid for 30 seconds.
- If Bob send the most recent Y to Alice, she must consider the key as valid.
- If Bob sens a more than 30sec old Y, Alice must not consider this key as valid.
Here is a more mathematical formulation with two functions E and D :
int Y = E(int X, int time) bool result = D(int X, int Y, int time)
- Variable X is the same for both functions
- The variable time is a value that changes every 30sec
- The function D must return true only if the time argument of the generated Y is the same as the one in argument of D.
(For the people that have a Battle.Net account, you will recognize that I'm looking for the same logic as the blizzard authentificator, in this case Alice is blizzard and the authentificator is Bob).
The question is what are the functions E and D. I guess there must be tons of possibilities, but what famous algorithms are used for this typical problem.