Created
October 28, 2018 09:01
-
-
Save chankruze/51cba66e6898611bc4a976f97c576f08 to your computer and use it in GitHub Desktop.
A simple hased password check script to demonstrate how servers check password when we enter it during log in.
This file contains hidden or 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 | |
print("# This is a demo on how servers checks your password when you enter it during login\n") | |
pass_in0 = input(">> Enter Your Demo Password\n") | |
hash_generate = hashlib.sha1(pass_in0.encode()) | |
hex_gen0 = hash_generate.hexdigest() | |
print(">> Your Stored Hash is: "+ str(hex_gen0)) | |
print("# This is stored in server when you signup for first time") | |
pass_in1 = input("\n>> Enter Demo Password Again To Varify\n") | |
hash_check = hashlib.sha1(pass_in1.encode()) | |
hex_gen1 = hash_check.hexdigest() | |
print(">> Your Calculated Hash is: "+ str(hex_gen1)) | |
print("# This is calculated at the time you login") | |
if (hex_gen0 == hex_gen1): | |
print ("\n[✔] Hashes Matched !") | |
print ("[✔] Password Verified !") | |
else: | |
print ("\n[✘] Hashes Didn't Matched !") | |
print ("[✘] Verification Failed !") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment