from microbit import *
from mb_file import *
from mb_disp import *
from mb_music import *
from hashing import *

password_hash=""
# Use one of the 10 most common passwords
# to set a new password on your micro:bit.
disp_clr() 
password1= input("Enter new password: ")
password2= input("Enter password again: ")
if password1 == password2:
# add salt here
  salt=""
  password_hash = sha_hash(password1)
  if salt!="":
    password_hash+=salt
    password_hash=sha_hash(password_hash)
  write_file("password.txt",password_hash)
  print("New password set!")
  music.play('music.BA_DING')
  display.show("Image.YES")
else:
  print("Passwords do not match, please\ntry again...")
  music.play('music.DADADADUM')
