brooksmoses: (Default)
[personal profile] brooksmoses
So, suppose you've got one of those electronic push-button combination locks, with (say) four-digit passcodes, and you want to try to unlock it by going through all the passcodes sequentially. Assuming you enter the passcodes independently, you've got 10 possibilities for each digit, so you need to enter 104 passcodes, so 40,000 button-pushes are required.

However, in practice the locks are designed not to get too confused by random inputs. A simplistic way of implementing such a thing that seems consistent with observed behavior of some real-world locks is to unlock at any point when the last four button pushes correspond to the correct passcode. This means that, for instance, if you push "1 2 3 4", and then push "5", it will unlock if the passcode is 2345. Thus, with the ten button presses "1 2 3 4 5 6 7 8 9 0", you can try the seven distinct passcodes 1234, 2345, 3456, 4567, 5678, 6789, and 7890.

Thus, the question: Given such a lock, what is the minimum number of button-pushes required to try out all of the passcodes, and how do you generate an ordering of button-pushes to do that?

An obvious lower bound is 10,003 -- you need three at the beginning that don't test anything, and then after that you can test no more than one new passcode per push, so at least 10,000 for all of them. But it's not immediately obvious (to me, anyway) that a sequence exists that will run through all of the passcodes without duplicates. Thus, the question is to either generate such a sequence, or to generate a minimal sequence and prove that it's minimal.

Date: 2009-01-23 09:36 pm (UTC)
From: [identity profile] suzanne.livejournal.com
Love you. Just saying.

Date: 2009-01-23 09:38 pm (UTC)
From: [identity profile] technolope.livejournal.com
There was an article in 2600 a few years ago that tackled that very same problem. The answer wasn't 10,003, it was somewhat higher, but not extraordinarily high. I don't have a reference to the article, though.

Date: 2009-01-23 09:49 pm (UTC)
From: [identity profile] novalis.livejournal.com
you want this (http://en.wikipedia.org/wiki/De_Bruijn_sequence)

Date: 2009-01-24 05:20 am (UTC)
ext_6381: (hyperbolic crochet)
From: [identity profile] aquaeri.livejournal.com
Yes, I knew that's what he wanted but couldn't remember the name.

Date: 2009-01-23 10:16 pm (UTC)
From: [identity profile] cjsmith.livejournal.com
I think it is almost eerie that I was imagining this same problem a day or two ago (while looking at the alarm panel in my house). Fun and amusing, but also almost eerie. :-)

Date: 2009-01-23 11:18 pm (UTC)
seawasp: (Default)
From: [personal profile] seawasp
I find it interesting that it works that way. If *I* were installing a security lock, I want it to open when you input the code, not when you input the code contained in a friggin' string of random numbers.

In fact, I want you to have three chances to input the code, and then the lethal gas is released and the automated machine-gun emplacements fire. If you make a mistake, you hit the *clear* button and try again.

Date: 2009-01-23 11:31 pm (UTC)
From: [identity profile] tiger-spot.livejournal.com
The code box I use regularly requires that you push "#" after you input the code. No lethal gas, though; it's outside so it would only dissipate and inconvenience the other commuters.

Date: 2009-01-23 11:32 pm (UTC)
From: [identity profile] suzanne.livejournal.com
"In fact, I want you to have three chances to input the code, and then the lethal gas is released and the automated machine-gun emplacements fire. If you make a mistake, you hit the *clear* button and try again."

That might be difficult to get past the inspectors, but it does have a certain old-world charm.

Date: 2009-01-23 11:51 pm (UTC)
seawasp: (Default)
From: [personal profile] seawasp
Um, how did you demonstrate I don't want that?

Your way: infinite retries until, eventually, you get in.

My way: three chances to get in, if you fail... YOU WILL BE EX-TER-MIN-AT-ED!

Obviously aim the lethal weapons such that they don't damage my precious house, of course. If it's an indoor security lock, use something like electrical charges. Or laughing gas. Or an army of trained weasels to run up your jockey shorts.

Your way: you can enter a string of numbers and try multiple codes in succession to break my security.

My way: If you don't actually know my code, you have to enter each individual code, in full, at a time. No freebies, no riding on prior work.

Yours is VASTLY less secure. It allows you to try forever until you succeed, and allows you to design test sequences which will much more efficiently run through the combination.

Where you get the idea that you know the first number, I don't know. Because you don't.

Date: 2009-01-24 01:53 am (UTC)
From: [identity profile] zwol.livejournal.com
No, he's entirely right (ignoring the "three strikes and you're dead" mode, which nobody actually wants). Lemme take a whack at explaining it.

If the door unlocks when the last four digits are the code, no matter what previous keypresses are, then you can crack the machine with a De Bruijn sequence of 10,000 keypresses.

If you have to hit "clear" before the machine will accept a new four-digit number, then you can crack the machine by trying all possible combinations of four-digit numbers, which is 50,000 keypresses (counting the "clear" before each one).

But, if the machine wants a five-digit sequence, and doesn't care about history, then you can crack it with a De Bruijn sequence ... of 100,000 keypresses. Twice as hard as your system.

Date: 2009-01-24 04:59 am (UTC)
seawasp: (Default)
From: [personal profile] seawasp
Firstly, there's a lot of systems -- most of the ones I've used over the years, in fact -- that have the X tries and You Are Dead approach, with X most commonly being 3. So your idea that no one would want such a system is... odd, to say the least. No computer system I've ever used (since the Good Old Days, anyway) would allow infinite retries, or even large numbers of them -- SPECIFICALLY to prevent this kind of "I'll get your password EVENTUALLY, my pretty!" attack.

There's any number of ways to deal with the "Bozo triggered my lock-out" trick; I have a special key that I can use to reset it, your lock-out alerts me and I can then do a remote reset, it will reset itself after some period of time (that I know and you do not), etc. It all depends on why you have the security set up and what your priorities are. The BEST security is still loyal human beings, but that's expensive and difficult to arrange. But I don't need to worry about keypunches on them.


Second, your "your password is Clear 1234" is just flat wrong. The password is 1234, and I can get in by entering those four digits, NO clear needed. Unless I screw up. Clear is only for "I started entering and I realized I messed it up and I want to back up before I enter a WRONG 4 digit code".

So no, I'm not willing, in your terminology, to press a five-button sequence to get in; I have a 4 digit sequence to get in with a button that lets me reset if I realize in time that I hit the wrong button. Moving your hypothetical to a 5 digit sequence with a known first number isn't equivalent.

Date: 2009-01-24 08:39 pm (UTC)
mapache: (Default)
From: [personal profile] mapache
But how do you know it's in a state where you don't need to push clear? If anyone entered anything while you weren't there, the system is in an unknown state, and you need to clear it, as you could be one keypress away from locking yourself out. If you're somehow introducing timing so that it auto-clears after a set period of time, then we just complicated the hardware.

And, as to the x-fails-equals-lockout, the correct way to implement this without allowing intentional DOS-via-lockout is to require exponential backoff. That is, screw up once, and you can try again. Screw up twice, and you have to wait a few seconds, keep screwing up, and the retry period increases up to some set max, then decays when left alone. (For a single-point-of-access system, like a door lock, this prevents brute force attacks while also preventing DOS lockouts. For a system like a password on a website, which can be accessed from multiple locations, you can still DOS it by keeping up a constant stream of bad passwords instead of stopping, so that's why you have to put in by-source lockouts too, at which point the attacker escalates to DDOS and now you have a real problem where you have to choose between allowing brute force attacks or locking out users.)

Date: 2009-01-24 10:38 pm (UTC)
seawasp: (Arrival HKF)
From: [personal profile] seawasp
How do I know? I'd presume the way I know on the ACTUAL security systems I use every day: I can see on the little LCD screen that there are entered symbols. I can't tell what they are, naturally -- they show up as asterisks, etc. -- but I can certainly tell. So if someone else had entered a partial code and left without clearing, it'd be obvious on the little screen.

And I hope you won't tell me you wouldn't have a screen because it's too complicated. Such screens are on every security system I've had to deal with in the past five years, at least, ranging from the one we use to secure the building at work to the POP/Debit Card stations at the supermarket. You need such feedback to make sure you actually hit the buttons correctly, etc. Standard interface design.

Date: 2009-01-24 10:51 pm (UTC)
From: [identity profile] tiger-spot.livejournal.com
The code box on the bike shelter at the train station doesn't have a screen.
Page generated Jan. 22nd, 2026 01:46 am
Powered by Dreamwidth Studios