2021年2月10日星期三

Generate a password from SHA3-512 hash value

I'm new to python, currently taking an IT as a master's degree. I'm working on decoding a password from a hash value.

This is how I'm currently set up. I know it's wrong and any help would be greatly appreciated.

# Based on code from: https://github.com/CyanCoding/Brute-Force-Password-Cracker/blob/master/Python/main.py  # Imports  import itertools  import time  from Crypto.Hash import SHA3_512    # Function to brute force the password  def tryPassword(passwordSet):      start = time.time()        # Allowed characters in the password      chars = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()_-+=[{]}|:;'\",<.>/?"            attempts = 0        for value in range(1, 9):          # Build up a string to test against, character by character          for letter in itertools.product(chars, repeat=value):              attempts += 1              letter = ''.join(letter)                #if the string we are building matches the password given to us, return from the function              if letter == passwordSet:                  end = time.time()                  distance = end - start                  return (attempts, distance)      password = input("Password >")  hash_object = SHA3_512.new()  hash_object.update(("password").encode("utf-8"))  tmp_hash = hash_object.hexdigest()  print(tmp_hash)    tries, timeAmount = tryPassword(password)  print("The password %s was cracked in %s tries and %s seconds!" % (password, tries, timeAmount))  
https://stackoverflow.com/questions/66147286/generate-a-password-from-sha3-512-hash-value February 11, 2021 at 08:49AM

没有评论:

发表评论