this is a general knowledge question, soon to turn into a project. I have a script that attempts to brute force a sha1 with a known salt. In this application anyways the salt is known. Anyways, script works fine, it’s a python script. When I run it, it tops out one core of 16 I have available. I would like too utilize all 16 cores for the brute force attack! I messed around a little with the script and was able to use an example here to utilize multiple cores, but they aren’t being used wholey.
http://forum.openopt.org/viewtopic.php?id=51
This parrelization stuff is pretty new to me and i’m not sure how to approach it in python (let alone any scripting language).
TL;DR, What is the best way in python to utilize all cores available for brute force on a hash, say, an MD5?
Essentially what I have now is this… (mind the paraphrased code)
from multiprocessing imports Pools
def prog()
generate hash_attempt
compare it to target
jobs = []
po = Pool()
for stuff in things:
po.apply_sync(prog())
This works but like I think I said, it doesn’t fully utilize all cores, and then sometimes it just randomly kills. It will just stop execution and the terminal I invoked the script will be back to it’s prompt and above it, it will say, “Killed”. Strange stuff.
Thanks a ton!
Due to the Global Interpreter Lock, you cannot usefully use Python threads for CPU-bound work. In this case, you’re going to have to use
multiprocessing.multiprocessingchild processes may not work 100% of a given CPU core due to communication overhead. To minimize communication overhead, allocate work to your child processes in large chunks rather than smaller chunks.