Algorithm digipass-like

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.

-
I added the question at the end. – user26462 Apr 26 '13 at 11:35
Alice just needs to sign the time stamp before sending the challenge X, and validate both the time stamp's signature and the 30 second rule on Bob's reply before decrypting his Y. It's pretty straight forward. Or are you thinking there's a homomorphic algorithm that is externally verifiable? – John Deters Apr 26 '13 at 12:53
You would have to specify some kind of security you want to achieve. As the question currently stands, the solution is trivial. Use the identity function as E and check that the values are the same in D. – Maeher Apr 26 '13 at 13:28