Think of simulating a security installation very similar to those installed in many offices and homes. The installation has a keypad and an engine (a controller) used to decide whether the user has entered the correct access key or not. The keypad has ten keys, labeled from '0' to '9'. The security engine will unlock the lock when it finds the correct access code in the input string. For example, let's assume that the access code is 33441. If the user enters the string 91352033441245, then the lock will be unlocked as soon as the engine finds the last correct letter of the access code in the input string. The engine will lock the lock again when the user enters the locking code. Assuming that the lock code is 33444 then the lock will be locked and unlocked as described below.
913520334412451033444123970001112334451334410101 unlock--^ ^--lock unlock--^
Your program will read from standard input without echoing the input characters. Characters other than digits 0 throuh 9 will be quietly discarded. Your engine will recognize a fixed access code. The access code will be first four digits of your Social Security Number, followed by a 1 for the unlock code and by a 4 for the locking code.
DDDD1 is the unlocking code DDDD4 is the locking code, where DDDD are the first four digits of your SSN
As soon as the last didgit of the access code is entered, your program will signal the action taken (lock or unlock).
Let's now assume that a possible intruder does not have any idea about how long the access string is. You decide to test how long it takes for one to unlock the lock. One possible way to try to break the lock is to generate a random sequence of numerical digits as the input string to the device. Of course, after each digit input from the keypad the intruder should check to see whether the lock has been unlocked or not. This would naturally increase the time it takes an intruder to break your security mechanism.
Direct the memo to your class instructor.
You don't need to be concerned about optimization(s). In particular you are not required to minimize the number of states in your FAs. You can do so if you want but this is not a must.
(c) 1996, Virgil Bistriceanu - email@example.com
Posted: November 17, 1996
Last update: November 17, 1996