Python Forum

Full Version: [SOLVED] How to crack hash with hashlib
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello team,

Could someone please shed some light on how to crack SHA3-512 hashes using hashlib or any other way?

What I have so far:

import hashlib

hash = b'a2099f4c2c2de141afb474dfe4b765ce83448100e77f4359314d94807b00862d53316c03963fc60cbdbd7bc6915778f1830f0f4fd9364a4bc71a09c5e83a0a67'

unhash = hashlib.sha3_512(hash.decode())
This is the error I get:

Error:
AttributeError: 'str' object has no attribute 'hexdigest'
I went through its documentation, but could not find anything helpful, nor anything online.

Thanks in advance

[EDIT]

SOLUTION:
from urllib.request import urlopen
import hashlib

sha3_512hash = input("[+] Enter sha3-512 Hash value: ")

password_list = str(urlopen('https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-1000000.txt').read(), 'utf-8')
for password in password_list.split('\n'):
    guess = hashlib.sha3_512(bytes(password,'utf-8')).hexdigest()
    if guess == sha3_512hash:
        print("[+] The password is: "+str(password))
        break
    elif guess != sha3_512hash:
        continue
    else:
        print("The password does not matched in the list…")