How hashcat deal with a list of hash?
#4
first:
your double for loop will result in an unneccessary overhead as you are running each password against nearly (until you find your hash) your whole list_of_hash, see the end of the post for a better (there is quite still better ways but i'll keep it simple) pythonic approach

second: lets have some fun with python

Code:
import hashlib
import sys
import tracemalloc

def md5_100k():
    result = []
    for i in range(1,100001):
        md5_hash = hashlib.md5(str(i).encode()).hexdigest()
        result.append(md5_hash)
    return result

tracemalloc.start()
result = md5_100k()
print(tracemalloc.get_traced_memory())
tracemalloc.stop()

output is (8906110, 8906274) so the whole program (with a 100k md5 hashlist in memory) consumes around 9 megabyte in total which is yeah cute isnt it? so yeah, load your hashes right away into ram

third, drop the second loop and dont forget to strip the newline from input (or you will generate and checking wrong md5)

so in total and depending on the size of your wordlist ( i use readlines to also read input file cmplete into memory), i added a modula counter for showing how "slow" this single threaded program is) lasted around ~50 seconds for hashing and comparing 10k real inputs

Code:
import hashlib

def md5_100k():
    result = []
    for i in range(1,100001):
        md5_hash = hashlib.md5(str(i).encode()).hexdigest()
        result.append(md5_hash)
    return result

list_md5 = md5_100k()

with open("wordlist.txt","r") as f:
    file_content = f.readlines()
    counter = 1
    for line in file_content:
        if counter % 100 == 0:
            print(counter)
        line = line.strip()
        calculate = (hashlib.md5(line.encode()).hexdigest())
        if calculate in list_md5:
            print(f"{calculate}:{line}")
        counter += 1
Reply


Messages In This Thread
RE: How hashcat deal with a list of hash? - by Snoopy - 07-20-2023, 07:29 PM