Skip to content

Instantly share code, notes, and snippets.

@ebubekirtrkr
Created April 23, 2021 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebubekirtrkr/236a86c0b7700cf5443de4b6878d2e1a to your computer and use it in GitHub Desktop.
Save ebubekirtrkr/236a86c0b7700cf5443de4b6878d2e1a to your computer and use it in GitHub Desktop.
Python sha256 example with multi-threading from file
import concurrent.futures
from hashlib import sha256
VERBOSE=False
output_file=open("hashed_passwords.txt","w+")
def do_sha256(passw):
hashed = sha256(passw.rstrip().encode()).hexdigest()
if VERBOSE:
print(hashed)
output_file.write(hashed+"\n")
output_file.flush()
MAX_THREADS=100
passwords = [ i for i in open("./hashcat/example.dict").read().splitlines()]
threads = min(MAX_THREADS, len(passwords))
with concurrent.futures.ThreadPoolExecutor(max_workers=threads) as executor:
executor.map(do_sha256, passwords)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment