示例#1
0
def main(args):
    nbits = int(args[0])
    A = int(args[1])
    B = int(args[2])
    p = int(args[3])
    order = int(args[4])
    Px = int(args[5])
    Py = int(args[6])
    Qx = int(args[7])
    Qy = int(args[8])

    if nbits != 40:
        return

    E = EllipticCurve(p, A, B, order)
    P = E.point(Px, Py)
    Q = E.point(Qx, Qy)

    print 'Bits =', nbits
    print 'E =', E
    print 'P =', P
    print 'Q =', Q

    for n in xrange(100):
        print '#', n+1
        start = time.time()
        x = multiprocess(E, P, Q)
        print 'x = ', x

        if (P*x != Q):
            print 'Wrong!'
            continue

        print 'Correct!'
        end = time.time()
        runtime = end - start
        format_time(runtime)
        f = open('results_cores.txt', 'a')
        s = str(int(runtime)) + ','
        f.write(s)
        f.close()

        print 'Tempo de execução: ', format_time(runtime)
        print '\n---------------------------------------\n'
示例#2
0
def main(args):
    nbits = int(args[0])
    A = int(args[1])
    B = int(args[2])
    p = int(args[3])
    order = int(args[4])
    Px = int(args[5])
    Py = int(args[6])
    Qx = int(args[7])
    Qy = int(args[8])

    if nbits < 32:
        return

    E = EllipticCurve(p, A, B, order)
    P = E.point(Px, Py)
    Q = E.point(Qx, Qy)

    # E = EllipticCurve(47, 34, 10)
    # P = E.point(30, 26)
    # Q = E.point(35, 41)

    # E = EllipticCurve(229, 1, 44)
    # P = E.point(5, 116)
    # Q = E.point(155, 166)

    print 'Bits =', nbits
    print 'E =', E
    print 'P =', P
    print 'Q =', Q

    while (True):
        try:
            start = time.time()
            now = datetime.now()
            moment = str(now.day)+'/'+str(now.month)+'/'+str(now.year)+' '\
            +str(now.hour)+':'+str(now.minute)+':'+str(now.second)
            print 'Started at', moment

            x = multiprocess(E, P, Q)

            print 'x =', x
            break
        except Exception, e:
            print 'Error:', str(e)

            end = time.time()
            timer = end - start
            runtime = format_time(timer)

            msg = MIMEText('Máquina: HighTower\n'
                           'Algoritmo: multiprocess\n'
                           'Bits = ' + str(nbits) + ' bits\n'
                           'E = ' + str(E) + '\n'
                           'P: ' + str(P) + '\n'
                           'Q: ' + str(Q) + '\n'
                           'Distinguished point: 28-bit\n'
                           'Tempo de execução: ' + runtime)
            msg['Subject'] = 'Erro detectado na curva de ' + str(
                nbits) + ' bits - HighTower'
            send_email(msg)
            print '---------------------------------------'
示例#3
0
def main(args):
    nbits = int(args[0])
    A = int(args[1])
    B = int(args[2])
    p = int(args[3])
    order = int(args[4])
    Px = int(args[5])
    Py = int(args[6])
    Qx = int(args[7])
    Qy = int(args[8])

    if nbits < 32:
        return

    E = EllipticCurve(p, A, B, order)
    P = E.point(Px, Py)
    Q = E.point(Qx, Qy)

    # E = EllipticCurve(47, 34, 10)
    # P = E.point(30, 26)
    # Q = E.point(35, 41)

    # E = EllipticCurve(229, 1, 44)
    # P = E.point(5, 116)
    # Q = E.point(155, 166)

    print 'Bits =', nbits
    print 'E =', E
    print 'P =', P
    print 'Q =', Q

    while (True):
        try:
            start = time.time()
            now = datetime.now()
            moment = str(now.day)+'/'+str(now.month)+'/'+str(now.year)+' '\
            +str(now.hour)+':'+str(now.minute)+':'+str(now.second)
            print 'Started at', moment

            x = multiprocess(E, P, Q)

            print 'x =', x
            break
        except Exception, e:
            print 'Error:', str(e)

            end = time.time()
            timer = end - start
            runtime = format_time(timer)

            msg = MIMEText(
                'Máquina: HighTower\n'
                'Algoritmo: multiprocess\n'
                'Bits = ' + str(nbits) + ' bits\n'
                'E = '+ str(E) + '\n'
                'P: ' + str(P) + '\n'
                'Q: ' + str(Q) + '\n'
                'Distinguished point: 28-bit\n'
                'Tempo de execução: ' + runtime)
            msg['Subject'] = 'Erro detectado na curva de ' + str(nbits) + ' bits - HighTower'
            send_email(msg)
            print '---------------------------------------'