예제 #1
0
def main():

    try:
        ecdl.loadConfig("config/config.json")
    except:
        print("Error opening config: " + sys.exc_info[0])
        sys.exit(1)

    mainLoop()
예제 #2
0
파일: solver.py 프로젝트: brichard19/ecdl
def main():

    try:
        ecdl.loadConfig("config/config.json")
    except:
        print("Error opening config: " + sys.exc_info[0])
        sys.exit(1)

    mainLoop()
예제 #3
0
파일: server.py 프로젝트: ajcj151/ecdl
def main():

    print("ECDLP Server")

    try:
        ecdl.loadConfig("config/config.json")
    except Exception as e:
        print("Error opening config file " + str(e))
        sys.exit(1)

    print("Starting server")
    app.run(host="0.0.0.0", port=ecdl.Config.port)
예제 #4
0
파일: server.py 프로젝트: brichard19/ecdl
def main():

    print("ECDLP Server")

    try:
        ecdl.loadConfig("config/config.json")
    except Exception as e:
        print("Error opening config file " + str(e))
        sys.exit(1)

    loadAllContexts()

    print("Starting server")
    app.run(host = "0.0.0.0", port = ecdl.Config.port)
예제 #5
0
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))
예제 #6
0
파일: solve.py 프로젝트: brichard19/ecdl
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))