Created
April 22, 2020 23:50
-
-
Save dustyfresh/028c4d91d69285314bfffe7c9229bdb9 to your computer and use it in GitHub Desktop.
script for quickly generating hash tables from a password list
This file contains hidden or 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
#!/usr/bin/env python | |
import json | |
import time | |
import hashlib | |
import multiprocessing as mp | |
class Hashes(object): | |
def md5(s): | |
return hashlib.md5(str(s).encode()).hexdigest() | |
def sha256(s): | |
return hashlib.sha256(str(s).encode()).hexdigest() | |
def sha1(s): | |
return hashlib.sha1(str(s).encode()).hexdigest() | |
def worker(passwd, md5_htable, sha256_htable, sha1_htable): | |
md5_htable[Hashes.md5(passwd)] = passwd | |
sha256_htable[Hashes.sha256(passwd)] = passwd | |
sha1_htable[Hashes.sha1(passwd)] = passwd | |
def main(): | |
manager = mp.Manager() | |
md5_htable = manager.dict() | |
sha256_htable = manager.dict() | |
sha1_htable = manager.dict() | |
pool = mp.Pool(16) | |
jobs = [] | |
for passwd in open('xato-net-10-million-passwords.txt', 'r').read().splitlines(): | |
pool.apply_async(worker, args=(passwd, md5_htable, sha256_htable, sha1_htable,)) | |
# close the pool as processing is complete | |
pool.close() | |
pool.join() | |
json.dump(dict(md5_htable), open('./hashtable_md5.json', 'w+')) | |
json.dump(dict(sha256_htable), open('./hashtable_sha256.json', 'w+')) | |
json.dump(dict(sha1_htable), open('./hashtable_sha1.json', 'w+')) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment