Пример #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
def main():

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

    mainLoop()
Пример #3
0
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
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
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))