Created
September 11, 2018 17:35
-
-
Save MikeTheWatchGuy/1ed9e1321466d3a1ba615ef2262beb4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
# ------------------------ Hash code generator ------------------------ | |
# use this code to generate your hashcode based on your password | |
# then paste the hash code into the variable secret_password_hash | |
# in the program you wish to password protect, copy and paste the lower 1/2 of this program. | |
password = input('Enter password to create hash: ') | |
try: | |
password_utf = password.encode('utf-8') | |
sha1hash = hashlib.sha1() | |
sha1hash.update(password_utf) | |
password_hash = sha1hash.hexdigest() | |
except: | |
exit(-1) | |
print("Copy and paste this value into your code", password_hash) | |
# ----------------------------- Paste this code into your program / script ----------------------------- | |
secret_password_hash = '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8' | |
password = input('Please enter your password: ') | |
password_utf = password.encode('utf-8') | |
sha1hash = hashlib.sha1() | |
sha1hash.update(password_utf) | |
password_hash = sha1hash.hexdigest() | |
if password_hash == secret_password_hash: | |
print('Login SUCCESSFUL') | |
else: | |
print('Login FAILED') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment