A Security Device


The purpose of this assignment is to get you to use Finite Automata concepts in solving real-life problems.

Part 1 (70 pts)

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 code or not.

The keypad has ten keys, labeled from '0' to '9'. The security engine will unlock the lock when it finds the correct un-locking access code in the input string. Likewise, the security engine will lock the lock when it finds the correct locking access code in the input string.

For example, let's assume that the un-locking 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 locking 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 the least significant five digits in your student ID, followed by a 1 for the unlock code and by a 4 for the locking code.

DDDDD1 is the unlocking code
DDDDD4 is the locking code, where DDDDD are the lest significant five digits in your student ID.

As soon as the last digit of the access code is entered, your program will signal the action taken (lock or unlock).

Part 2 (20 pts)

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.

  • Try to estimate how long it would take (on the average) to break the lock if one has to wait one second to see if the lock has unlocked or not. Assume the random number generator has an uniform distribution.
  • Do the actual test: use some random number generator to generate the input string for the security device. Count how many symbols (digits from 0 to 9) have been generated before the lock is unlocked. Ignore the waiting time in this case and have the program run at full speed. Since you use random numbers you will have to repet the test several times to obtain significant results; find the minimum, maximum and the average.

Submission (10 pts)

  1. Send us link to your git repository for the assignment. Make sure the repo either public or, otherwise, is shared with your instructor -- bistriceanu@iit.edu on Bitbucket, virgil@thesleepless.com on Github -- and with your TA, lzhang115@hawk.iit.edu

    (5 pts) Your repo must contain a README file that describes what the program does, how to build and run the executable, how to generate unit test coverage, the platform it's been tested on, plus any other information you consider useful - like the name of the author, licensing, etc.

  2. (5 pts) A memo describing what you have done, how you have done it, and your findings. In the memo clearly state what is the language of the FA you have implemented. Also indicate what is the regular expression corresponding to that language. Attach the state transition diagram for the FA.
  3. Direct the memo to your class instructor.

    NOTE: 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.


How We Test

General Conditions

We are not going to test your project from within an IDE, whether Eclipse, Visual Studio, or anything else.

Test Environments

  1. A fresh installation of Ubuntu 22.04 LTS (Jammy Jellyfish)
  2. A fresh installation of Windows 11

Testing Algorithm

  1. Clone your project repository into a local directory on our test machine.
  2. 
        mkdir /tmp/john-smith ; cd /tmp/john-smith
        git clone <link-to-john-smith-project-repository>
      
    If we cannot clone your repository then STOP, assign a score of zero for the project.

  3. Read the README file you provided.
  4. If the README file is missing, or the file exists but specific setup instructions are missing from it then STOP, assign a score of zero for the project.

  5. We'll then attempt to create an executable. For example, if the README file says that we should execute ./gradlew clean build then we'll do just that.

    If your build instructions are missing or fail to generate an executable then STOP, assign a score of zero for the project.

  6. If your instructions for how to generate unit test coverage are missing from the README file, or they are present but fail to produce unit test coverage then we are going to be quite disappointed.

  7. If (executable) fails to deploy/start then STOP, assign a score of zero for the project.

  8. Proceed to functional testing.

Last update: Oct 17, 2022 Virgil Bistriceanu cs330 Computer Science