Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

discrete_log_rho OverflowError: Python int too large to convert to C long

When I run this code below, I get OverflowError, How can I fix this? keep this big prime

import random
import time
@interact
def _(a1=0,a2=0,a3=0,a4=0,a5=7,p1=('p',input_box(default=1461501637330902918203684832716283019655932584637)),auto_update=False):
    p=p1
    if (is_prime(p)==True):
        print 'Elliptic Curve yang digunakan y^2 + a1*xy + a3*y = x^3 + a2*x^2 + a4*x + a5'
        F = GF(p)
        E = EllipticCurve(F,[a1,a2,a3,a4,a5])
        G = E.gen(0)
    random = randint(0,p)
    P = random*G
    if (is_prime(P.order())==True):
        random1 = randint(0,7000)
        Q = random1*P
        print 'P = ',P
        print 'Q = ',Q
        print 's = ', random1
        print '#Break ECC dengan Algoritma Pollard Rho (Q = k*P), k=?'

        print 'Start searching....'
        start = time.time()
        k = discrete_log_rho(Q, P, ord = P.order(), operation='+')
        print 'Key found!!!'
        print 'Key = s = ',k
        end = time.time()
        print 'Waktu komputasi = ',end-start,'detik'
    else:
        print 'Gagal. Orde P tidak prime!!'
else:
    print 'p harus bilangan prima!'

discrete_log_rho OverflowError: Python int too large to convert to C long

When I run this code below, I get OverflowError, How can I fix this? keep this big prime

import random
import time
@interact
def _(a1=0,a2=0,a3=0,a4=0,a5=7,p1=('p',input_box(default=1461501637330902918203684832716283019655932584637)),auto_update=False):
    p=p1
    if (is_prime(p)==True):
        print 'Elliptic Curve yang digunakan y^2 + a1*xy + a3*y = x^3 + a2*x^2 + a4*x + a5'
        F = GF(p)
        E = EllipticCurve(F,[a1,a2,a3,a4,a5])
        G = E.gen(0)
    random = randint(0,p)
    P = random*G
    if (is_prime(P.order())==True):
        random1 = randint(0,7000)
        Q = random1*P
        print 'P = ',P
        print 'Q = ',Q
        print 's = ', random1
        print '#Break ECC dengan Algoritma using Pollard Rho Algorithm (Q = k*P), k=?'

        print 'Start searching....'
        start = time.time()
        k = discrete_log_rho(Q, P, ord = P.order(), operation='+')
        print 'Key found!!!'
        print 'Key = s = ',k
        end = time.time()
        print 'Waktu komputasi 'Computation time = ',end-start,'detik'
    else:
        print 'Gagal. Orde 'Failed. Order P tidak is not prime!!'
else:
    print 'p harus bilangan prima!'
must be prime!'

discrete_log_rho OverflowError: Python int too large to convert to C long

When I run this code below, I get OverflowError, How can I fix this? keep this big prime

import random
import time
@interact
def _(a1=0,a2=0,a3=0,a4=0,a5=7,p1=('p',input_box(default=1461501637330902918203684832716283019655932584637)),auto_update=False):
_(a1=0,a2=0,a3=0,a4=0,a5=7,p1=('p',input_box(default=4294968289)),auto_update=False):
    p=p1
    if (is_prime(p)==True):
        print 'Elliptic Curve yang digunakan y^2 + a1*xy + a3*y = x^3 + a2*x^2 + a4*x + a5'
        F = GF(p)
        E = EllipticCurve(F,[a1,a2,a3,a4,a5])
        G = E.gen(0)
     random = randint(0,p)
     P = random*G
     if (is_prime(P.order())==True):
         random1 = randint(0,7000)
randint(0,p)
            Q = random1*P
         print 'P = ',P
         print 'Q = ',Q
         print 's = ', random1
         print '#Break ECC using dengan Algoritma Pollard Rho Algorithm (Q = k*P), k=?'

        print 'Start searching....'
            #Now we need to find the private key: q1 = G*privateKey so we do this: 
            print 'Mulai mencari.......'
            start = time.time()
         k = discrete_log_rho(Q, P, ord = P.order(), operation='+')
         print 'Key found!!!'
ditemukan!!!'
            print 'Key = s = ',k
         end = time.time()
         print 'Computation time = ',end-start,'detik'
     else:
         print 'Failed. Order Orde P is not prime!!'
 else:
     print 'p must be prime!'

discrete_log_rho OverflowError: Python int too large to convert to C long

When I run this code below, I get OverflowError, How can I fix this? keep this big prime

import random
import time
@interact
def _(a1=0,a2=0,a3=0,a4=0,a5=7,p1=('p',input_box(default=4294968289)),auto_update=False):
_(a1=0,a2=0,a3=0,a4=0,a5=7,p1=('p',input_box(default=1461501637330902918203684832716283019655932584637)),auto_update=False):
    p=p1
    if (is_prime(p)==True):
        print 'Elliptic Curve yang digunakan y^2 + a1*xy + a3*y = x^3 + a2*x^2 + a4*x + a5'
        F = GF(p)
        E = EllipticCurve(F,[a1,a2,a3,a4,a5])
        G = E.gen(0)
        random = randint(0,p)
        P = random*G
        if (is_prime(P.order())==True):
            random1 = randint(0,p)
            Q = random1*P
            print 'P = ',P
            print 'Q = ',Q
            print 's = ', random1
            print '#Break ECC dengan Algoritma Pollard Rho (Q = k*P), k=?'
            #Now we need to find the private key: q1 = G*privateKey so we do this: 
            print 'Mulai mencari.......'
            start = time.time()
            k = discrete_log_rho(Q, P, ord = P.order(), operation='+')
            print 'Key ditemukan!!!'
            print 'Key = s = ',k
            end = time.time()
            print 'Computation time = ',end-start,'detik'
        else:
            print 'Failed. Orde P is not prime!!'
    else:
        print 'p must be prime!'

discrete_log_rho OverflowError: Python int too large to convert to C long

When I run this code below, I get OverflowError, How can I fix this? keep this big prime

import random
import time
@interact
def _(a1=0,a2=0,a3=0,a4=0,a5=7,p1=('p',input_box(default=1461501637330902918203684832716283019655932584637)),auto_update=False):
    p=p1
    if (is_prime(p)==True):
        print 'Elliptic Curve yang digunakan y^2 + a1*xy + a3*y = x^3 + a2*x^2 + a4*x + a5'
        F = GF(p)
        E = EllipticCurve(F,[a1,a2,a3,a4,a5])
        G = E.gen(0)
        random = randint(0,p)
        P = random*G
        if (is_prime(P.order())==True):
            random1 = randint(0,p)
            Q = random1*P
            print 'P = ',P
            print 'Q = ',Q
            print 's = ', random1
            print '#Break ECC dengan Algoritma Pollard Rho (Q = k*P), k=?'
            #Now we need to find the private key: q1 = G*privateKey so we do this: 
            print 'Mulai mencari.......'
'Start searching.......'
            start = time.time()
            k = discrete_log_rho(Q, P, ord = P.order(), operation='+')
            print 'Key ditemukan!!!'
            print 'Key = s = ',k
            end = time.time()
            print 'Computation time = ',end-start,'detik'
        else:
            print 'Failed. Orde P is not prime!!'
    else:
        print 'p must be prime!'