Enter the maze

Hotel Doors and Keycode algorithms: a solution

One solution to the hotel door problem is as follows:

The door stores a single LOCK key code - the one it currently uses to match against ones on cards put in its lock.

Every card, however, has two key codes: an OLD code and a NEW code. They are both added to the card by the receptionist's computer when the guest checks-in. The OLD code is just set to whatever the last guest's NEW code was. The NEW code is set to a completely new number not used before for that room.

Either code on the card (OLD or NEW) will let you in if it matches the current LOCK code.

The OLD code does more though. When recognized by a lock as the door's current LOCK code it causes the lock to change its LOCK code to the NEW code on the card. From then on only the NEW code matches the door but that is OK as it is on the new guest's card. It isn't on the old guest's card though. From that point on they can no longer enter the room, even if they kept their card as neither its OLD or NEW numbers now match.

Can you think of any potential flaws where this scheme could go wrong?

back to the hotel door problem