I was trying something when I came across this problem. I have a hashed password stored in a file on my computer. However the way my code detects whether or not a password has already been set is it checks if that file exists. If it does than it will ask you for the password that has been set. If the file does not exist than it will ask you to set a new password. But this also means that theoretically if someone wanted to break in they could just delete that file and enter a new password.
How do you go about solving this? I am not sure if this is a totally stupid question or not but I have no clue how to solve this.
You don't have to ask for a password at all.
Just deny all other users access to your script by settings permissions.
If you are sharing your user account consider someone could simply remove the password prompt from your script.
How to properly save one hashed password