3 ms·
And even if the number is randomly generated, many devices accept any string of digits that end with the correct four digits. Pressing "12345" actually tests bo
by kqr 2y ago
And even if the number is randomly generated, many devices accept any string of digits that end with the correct four digits. Pressing "12345" actually tests both codes "1234" and "2345".
I'm sure there's an optimal sequence of keypresses that tests all 10000 codes in something like 30,000 keypresses rather than the naive 40,000.
- quesera 2y agoAlso true of those old "lockbox" key lockers that real estate agents use to "protect" the keys to your house. This made me uncomfortable when I was selling a house, so naturally I wrote some code to generate a string of digits that would cover the full solution space most efficiently. Armed with this "master key", I had the lockbox open in negligible time. Honestly I think it was just a few minutes, and I was about halfway through the string. This let me put the key out only when a showing was happening, and I brought the lockbox to the closing, which baffled the real estate agent.
- speq 2y agoYes, there's some solid theory behind it: https://en.wikipedia.org/wiki/De_Bruijn_sequence https://en.wikipedia.org/wiki/De_Bruijn_sequence It seems that you can do it in 10003 key presses. Calculation for this this exact example is in the Wikipedia page.