Created
December 15, 2015 02:32
-
-
Save XertroV/45ff874396b93bc85dab to your computer and use it in GitHub Desktop.
Password Trainer - simple script to remember a password and help you practise
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
#!/usr/bin/env python3 | |
import getpass | |
import time | |
print("Please input your password carefully.") | |
password = getpass.getpass() | |
print("Thank you, please type it again to confirm") | |
p2 = getpass.getpass() | |
if password != p2: | |
print("Mismatching passwords, please try again.") | |
exit() | |
best_time = 99999999999 | |
while True: | |
print('') | |
t1 = time.time() | |
p = getpass.getpass() | |
duration = time.time() - t1 | |
if p != password: | |
print("Incorrect... %0.2f s" % duration) | |
else: | |
print("Correct! You took %0.2f s" % duration) | |
if duration < best_time: | |
print("New best time!") | |
best_time = duration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment