fix for cpu without 2^n cores

This commit is contained in:
Sam Hadow 2024-04-23 12:45:11 +02:00
parent c267c560c0
commit a7ea96648d

14
main.py
View File

@ -151,18 +151,18 @@ def attack(Bytes=gen_6_bytes()):
max_upper_limit = 2**16
chunk_size = max_upper_limit // num_cores
for i in range(num_cores):
for i in range(num_cores-1):
start = i * chunk_size
end = start + chunk_size
process = multiprocessing.Process(target=attack_worker, args=(start, end, Bytes, result_queue, stop_event))
processes.append(process)
process.start()
# # last process
# start = (num_cores-1) * chunk_size
# end = max_upper_limit
# process = multiprocessing.Process(target=attack_worker, args=(start, end, Bytes, result_queue, stop_event))
# processes.append(process)
# process.start()
# last process
start = (num_cores-1) * chunk_size
end = max_upper_limit
process = multiprocessing.Process(target=attack_worker, args=(start, end, Bytes, result_queue, stop_event))
processes.append(process)
process.start()
for process in processes:
process.join()