I've been working on a program to obtain a rainbow table, using a crc32 hash.
The main loop of the program is the following:
from zlib import crc32
from string import ascii_lowercase
from itertools import product
...
rt = {}
i = 0
for p in product(ascii_lowercase, repeat = 8):
i += 1
print('\n%d' % i)
p = ''.join(p)
print('\nCurrent password = %s' % p)
r = bytes(p, 'utf-8')
h = hex(crc32(r))
for j in range(2**20):
h = list(h)
del h[0]
del h[0]
for k in range(0, len(h)):
if (h[k].isdigit()):
h[k] = chr(ord(h[k]) + 50)
h = ''.join(h)
r = bytes(h, 'utf-8')
h = hex(crc32(r))
h = list(h)
del h[0]
del h[0]
h = ''.join(h)
print('\nFinal hash = %s\n' % h)
rt[p] = h
if (i == 2**20):
break
So, the code does its works as I intend it to, and when it exits the loop it stores the generated rainbow table (variable rt) into memory. Well, with the current number of iterations shown in the above code, it would take several days to complete its execution, and I need to create this table, as well as others with different iterations through the loops, in order to do some tests on them.
I thought that I'd be a good idea to attempt to parallelize it, but after going through the documentation on multiprocessing and lurking through some posts about it, I'm still unable to parallelize it in a correct way.
Thanks in advance!