Key fobs for remotely locking/unlocking car doors are standard equipment at this point and keyless ignitions using key fob recognition is now standard in over 60% of new car models according to Edmonds. Future generations won’t know that we used to use actual keys to unlock and start our cars.
Key fobs transmit a radio signal to the car and if the car recognizes the transmission as coming from the right fob(s) it will perform the command encoded in the radio transmission.
All key fobs of U.S. manufacturers use a radio signal frequency of 315 MHz and foreign models us 433.92 MHz. Because all fobs use just one of two frequencies, the security relies on both the fob (transmitter) and car electronics (receiver) knowing the same code which changes after every press of the key fob button (or otherwise communicating with each other). Both the transmitter and receiver know the code numbers as they change because they are programmed with the same code generating algorithm. So, both the car and fob know what code number will be next due to sharing an algorithm.
The mathematics of the quasi-randomly generated codes is that it is about a one-in-a-billion chance that a car would mistakenly unlock because of a duplicate code transmission from a wrong fob.
What happens if you press the key fob button when you aren’t in range of the car? Now the car receiver and fob transmitter are no longer in sync as the fob will move one code number ahead of the car receiver. This problem is solved by the receiver scanning the upcoming 256 codes every-time it receives a signal to see if any of those codes match. If so, it accepts the code and resets the starting point.
So, you can press your key fob up to 256 times out of range of your car without messing up the encryption system. However if you (or your toddler or drunk spouse) press it 257 times you have an issue and will need to figure out how to reset it. (I’d love if someone reading this blog post would test this out.)
Related question/answer: my car has “keyless entry” meaning it opens if I touch the handle and I have the key fob in my pocket and I can also lock it by touching the handle with the fob in my pocket. If you have keyless entry and/or keyless ignition, then the key fob is constantly transmitting a code and then changes its code after an interaction with the car receiver. Many times, I have in inadvertently left the fob inside the car and touched the handle to lock the car. It won’t lock. It knows that the fob is INSIDE the car and not in my pocket. How does it know? Answer: the car has multiple antennae around the car and uses those antennae to triangulate the location of the fob and thus the fob only works when it’s in the appropriate location (outside the car to lock it and unlock it and inside the car to start and operate the car).
UPDATE – If you have a keyless ignition and a keyless entry system, your key fob is constantly sending out a radio signal with the appropriate code. The technology does exist for a car thief to intercept that code, amplify it with a pirate fob and use it to open/start and drive your car away. To combat this, police suggest keeping your key fob in a metal container or even in your refrigerator or microwave!