def getContext(id): names = ecdl.Database.getNames() if id in names: return ecdl.loadContext(id) return None
def mainLoop(): while True: contextNames = ecdl.Database.getNames() if contextNames != None and len(contextNames) != 0: # Get a list of unsolved contexts ctxList = [] for name in contextNames: ctx = ecdl.loadContext(name) if ctx.status.lower() == 'unsolved' and ctx.collisions > 0: ctxList.append(ctx) solveNextCollision(ctx) # If anything is in the list, solve them if len(ctxList) > 0: for ctx in ctxList: solveNextCollision(ctx) else: time.sleep(30) else: time.sleep(30)
def mainLoop(): while True: contextNames = ecdl.Database.getNames() if contextNames != None and len(contextNames) != 0: # Get a list of unsolved contexts ctxList = [] for name in contextNames: ctx = ecdl.loadContext(name) if ctx.status.lower() == 'unsolved' and ctx.collisions > 0: ctxList.append(ctx) solveNextCollision(ctx) # If anything is in the list, solve them print( "Unsolved jobs: " + str(len(ctxList))) if len(ctxList) > 0: for ctx in ctxList: solveNextCollision(ctx) else: time.sleep(30) else: time.sleep(30)
def loadAllContexts(): names = ecdl.Database.getNames() if names == None: return for n in names: print("Loading context '" + n + "'") ctx = ecdl.loadContext(n) _ctx[ctx.name] = ctx
def main(): if len(sys.argv) != 8: print("Usage: a1 b1 a2 b2 x y job") exit() a1 = parseInt(sys.argv[1]) b1 = parseInt(sys.argv[2]) a2 = parseInt(sys.argv[3]) b2 = parseInt(sys.argv[4]) endX = parseInt(sys.argv[5]) endY = parseInt(sys.argv[6]) name = sys.argv[7] try: ecdl.loadConfig("config/config.json") except: print("Error opening config: " + sys.exc_info[0]) sys.exit(1) ctx = ecdl.loadContext(name) curve = ctx.curve rPoints = ctx.rPoints dBits = ctx.params.dBits # Get G and Q g = ECPoint(ctx.params.gx, ctx.params.gy) q = ECPoint(ctx.params.qx, ctx.params.qy) endPoint = ECPoint(endX, endY) # Calculate starting points p1Start = curve.add(curve.multiply(a1, g), curve.multiply(b1, q)) p2Start = curve.add(curve.multiply(a2, g), curve.multiply(b2, q)) a1, b1, point1, a2, b2, point2 = findCollision(curve, g, q, a1, b1, p1Start, a2, b2, p2Start, endPoint, rPoints, dBits) if a1 == None: return # Compute private key k = (((a1 - a2) % curve.n) * invm(b2 - b1, curve.n)) % curve.n r = curve.multiply(k, g) print("Q= " + hex(q.x) + " " + hex(q.y)) print("kG = " + hex(r.x) + " " + hex(r.y)) print("") print("k=" + hex(k))
def main(): if len(sys.argv) != 8: print("Usage: a1 b1 a2 b2 x y job") exit() a1 = parseInt(sys.argv[1]) b1 = parseInt(sys.argv[2]) a2 = parseInt(sys.argv[3]) b2 = parseInt(sys.argv[4]) endX = parseInt(sys.argv[5]) endY = parseInt(sys.argv[6]) name = sys.argv[7] try: ecdl.loadConfig("config/config.json") except: print("Error opening config: " + sys.exc_info[0]) sys.exit(1) ctx = ecdl.loadContext(name) curve = ctx.curve rPoints = ctx.rPoints dBits = ctx.params.dBits # Get G and Q g = ECPoint(ctx.params.gx, ctx.params.gy) q = ECPoint(ctx.params.qx, ctx.params.qy) endPoint = ECPoint(endX, endY) # Calculate starting points p1Start = curve.add(curve.multiply(a1, g), curve.multiply(b1, q)) p2Start = curve.add(curve.multiply(a2, g), curve.multiply(b2, q)) a1, b1, point1, a2, b2, point2 = findCollision(curve, g, q, a1, b1, p1Start, a2, b2, p2Start, endPoint, rPoints, dBits) if a1 == None: return # Compute private key k = (((a1 - a2)%curve.n) * invm(b2 - b1, curve.n)) % curve.n r = curve.multiply(k, g) print("Q= " + hex(q.x) + " " + hex(q.y)) print("kG = " + hex(r.x) + " " + hex(r.y)) print("") print("k=" + hex(k))