Skip to content

Instantly share code, notes, and snippets.

@ticoombs
Created September 10, 2015 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ticoombs/5ab79f2b1bc7db58fa65 to your computer and use it in GitHub Desktop.
Save ticoombs/5ab79f2b1bc7db58fa65 to your computer and use it in GitHub Desktop.
#!/env/bin/python
# lines: 1 words: 3 bytes: 24
# md2: e53bfab73600e05e76546bfbc5509b76
# md4: 8ffed6ee507df5b5462c8b1764eab098
# md5: 1ceab1f5b327682c7835e21b96711429
# sha1: df8d27fb77e06e989eade44ce01165689a9ec527
# sha224: 3195d72d2b1b012d1833243fd73270b05c350fed54a9bb9652de0cbe
# sha256: d383bfaff00ccd347dc40276430a0023d088edf3db35f91db4b481eb52718d3d
import hashlib
import subprocess
import threading
number_cpus = 4
def readfile():
with open("words.js", "r") as f:
words = f.read().splitlines()
return words
def genword():
gen = subprocess.check_output(["gen -w 3"], shell=True)
gen = gen.strip()
if len(gen) == 24:
return gen
else:
return "NULL"
def work():
while True:
twentyfour = genword()
if "NULL" != twentyfour:
print "%s: Trying: %s" % (threading.currentThread().getName(), twentyfour)
md5 = hashlib.md5(twentyfour)
if md5 == "1ceab1f5b327682c7835e21b96711429":
print "COLLISION FOUND: MD5: %s, %s" % (md5, twentyfour)
exit(0)
if __name__ == "__main__":
words = readfile()
threads = []
for i in range(number_cpus):
t = threading.Thread(target=work)
threads.append(t)
t.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment