Rolling code, also known as hopping code, is a security technology commonly used to provide a fresh code for each authentication of a remote keyless entry (RKE) or passive keyless entry (PKE) system. The use of rolling codes prevents replay attacks, in which an eavesdropper accesses and records the code sent and then replays it to breach the system.
In a non-cryptographic system for rolling code, the transmitter and receiver use the same pseudo-random number generator (PRNG), which maintains information about the last code that was used and a calculation to be performed. Performing the calculation results in the generation of a non-repeating and specific sequence of numbers. When one end of the communication -- the key fob, for example, or the module in the vehicle -- transmits the next number in the sequence, the other end can check it with its own PRNG. A current system might use a 40-bit rolling code for about a trillion possible codes.
If the code matches, the system authenticates and the car door unlocks. Otherwise, the system will roll through the sequence of numbers looking for the one that was sent. Each successful use of the system results in synchronization of the end points, which means that the system should work on the first try next time.
Cryptographic rolling code systems add the further element of a secret key that is shared by the transmitter and receiver.