I moved into an apartment complex where the key is both unique to each apartment door, but every key can open the front door, how are both possible?
In: 986
Imagine the key has eight teeth.
The first four are different for each key, and unlock your individual doors.
The last four are the same for each key, and open the main door.
Your exact arrangement will vary, but the concept will be the same.
Many common residential keys have 5 or more different positions that move pins various distances when inserted into a lock.
Common area lock cylinders can be configured to only check one of those positions, and as long as every tenant has a key with that position cut to the same depth, every key will open that lock.
Your key is a series of numbers (called cuts). When you try to use that key, you test if the lock has the same numbers. You can keep some of those numbers the same for all doors in your building and only test for those on the front door and use the rest for individual apartments.
The front door has less pins in the lock. The key goes in and only the end few cuts on the key are needed. Then when you get to your door the lock has more pins and the key goes in farther and uses more of the cut pattern on the key.
The front door has fewer pins in the lock compared your apartment door, so all the keys have those bumps the same and then differences in the remaining pins.