from microbit import *
from hashing import *
from mb_file import *
from mb_music import *
disp_clr()
attempts = 0
for n in range(3):
  password = input("Enter password: ")
  # add salt here
  salt=""
  test_hash = sha_hash(password)
  if salt!="":
    test_hash+=salt
    test_hash=sha_hash(test_hash)
  authentic_hash = read_file("password.txt")
  if test_hash == authentic_hash:
    print("Authenticated!")
    music.play('music.BA_DING')
    break
  else:
    music.play('music.DADADADUM')
    print("You have {} attempts remaining...".format(3-n-1))
    if n == 2:
      disp_clr()
      print("You are locked out of your\naccount!")
