import hashlib import time from random import randint micsta = "Michal Starski (434786)\n" hashlast = '' #for 0.txt while 1: str = '' for k in range(32): str = str + hex(randint(0,15))[2:] str = str + '\n' hash = hashlib.md5( (micsta + str).encode('utf-8') ).hexdigest() if hash[0:2] == '00' and hash[30:32] == '00': f = open('0.txt', 'w+') f.write(micsta+str) f.close hashlast = hash + '\n' break #for 1.txt and 2.txt p = 1 while 1: while 1: str = '' for k in range(32): str = str + hex(randint(0,15))[2:] str = str + '\n' hash = hashlib.md5( (micsta+hashlast+str).encode('utf-8') ).hexdigest() if hash[0:2] == '00' and hash[30:32] == '00': print( repr(p) ) f = open( (repr(p)+'.txt'),'w+') f.write(micsta+hashlast+str) f.close() break p = p + 1 hashlast = hash+'\n'