Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. from pymd5 import md5, padding
  2. import os
  3.  
  4. with open("prefix") as f:
  5. prefix = f.read().strip()
  6.  
  7. os.system("./fastcoll -p prefix -o col0 col1")
  8. with open("col0") as f:
  9. col0 = f.read().strip()
  10. with open("col1") as f:
  11. col1 = f.read().strip()
  12.  
  13. blobs = []
  14. index = 0
  15. chunk_size = 2
  16. blob2old = ""
  17. blob3old = ""
  18.  
  19. # while True:
  20. # if ('(' or ')' in col0) or ('(' or ')' in col1):
  21. # os.system("./fastcoll -p prefix -o col0 col1")
  22.  
  23. blobs.append(col0)
  24. blobs.append(col1)
  25.  
  26.  
  27. while True:
  28. # for i in range(0, 5):
  29. os.system("./fastcoll -i " + md5(blobs[index]).hexdigest() + " -o blob2 blob3")
  30.  
  31. with open("blob2") as f:
  32. blob2 = f.read().strip()
  33. with open("blob3") as f:
  34. blob3 = f.read().strip()
  35.  
  36. if ('(' in blob2) or (')' in blob2) or ('(' in blob3) or (')' in blob3):
  37. if blob2 != blob2old:
  38. print "blob2 diff"
  39. blob2old = blob2
  40. continue
  41. # while True:
  42. # os.system("./fastcoll -i " + md5(blobs[index]).hexdigest() + " -o blob2 blob3")
  43. # with open("blob2") as f:
  44. # blob2 = f.read().strip()
  45. # with open("blob3") as f:
  46. # blob3 = f.read().strip()
  47. #
  48. # if '(' or ')' in blob2 or '(' or ')' in blob3:
  49. # if blob2 != blob2old:
  50. # print "blob2 diff"
  51. # blob2old = blob2
  52. # continue
  53. # else:
  54. # break
  55.  
  56. for j in range(0, chunk_size):
  57. blobs.append(blobs[index+j] + padding(len(blobs[index+j])*8) + blob2)
  58. print md5(blobs[index+j] + padding(len(blobs[index+j])*8) + blob2).hexdigest()
  59. blobs.append(blobs[index+j] + padding(len(blobs[index+j])*8) + blob3)
  60. print md5(blobs[index+j] + padding(len(blobs[index+j])*8) + blob3).hexdigest()
  61.  
  62. index += chunk_size
  63. chunk_size *=2
  64. if chunk_size == 64:
  65. break
  66.  
  67. index = len(blobs) - 64
  68. for k in range(0,64):
  69. filename = "blobs/blob" + str(k)
  70. with open(filename, "w") as f:
  71. f.write(blobs[index+k])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement