+ 1
why is this code is not showing the time to it take to finish the process 😒
from urllib.request import urlopen, hashlib import time start_time = time.time() sha1hash = input("Please input the hash to crack.\n>") with open('password_file.txt') as f: LIST_OF_COMMON_PASSWORDS = f.read() for guess in LIST_OF_COMMON_PASSWORDS.split('\n'): hashedGuess = hashlib.sha1(bytes(guess, 'utf-8')).hexdigest() if hashedGuess == sha1hash: print("The password is ", str(guess)) quit() elif hashedGuess != sha1hash: print("Password guess ",str(guess)," does not match, trying next...") print("Password not in database, we'll get them next time.") end_time = time.time() print("Time taken: ", end_time - start_time)
4 Réponses
+ 4
ANAS IL CAPO
It would be easier for people to help you if you give a short description of your code and the expected outputs.
Assuming the code runs without errors on your pycharm, my guess would be that the `quit()` statement is causing the program to exit before reaching the end and printing the time taken. Try replacing quit() with `break` to exit the loop but not the program itself.
+ 1
If you mean on Sololearn, it is because it cannot find the file, so it doesn't run correctly here.
0
no in pycharm
0
How I can create my own website