from microbit import *
from hashing import *
from mb_file import *
from mb_pins import *
from servo_7 import *


disp_clr()
input("Close lid and [enter] to lock")
lock()
attempts = 0
for n in range(3):
  password = input("Enter password: ")
  test_hash = sha_hash(password)
  authentic_hash = read_file("password.txt")
  if test_hash == authentic_hash:
    print("Authenticated!")
    unlock()
    input("Close lid and [enter] to lock")
    lock()
    print("All locked up!")
    break
  else:
    print("You have {} attempts remaining...".format(3-n-1))
    if n == 2:
      disp_clr()
      print("You are locked out of your\naccount!")