design a password using sequential circuit
Each time you enter a code, shift it (the 4-bits) into an 16-bit shift register. Use a 4-bit compare to detect the "#" code, and when you have a match there, latch the output of a 16-bit comparator which compares the last 4 digits with the correct code, that's the 4 digits in the 16-bit register.