Created
April 23, 2021 12:42
-
-
Save ebubekirtrkr/236a86c0b7700cf5443de4b6878d2e1a to your computer and use it in GitHub Desktop.
Python sha256 example with multi-threading from file
This file contains 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
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