Ask Your Question

Niyamabrata's profile - activity

2019-06-07 18:00:29 -0500 received badge  Notable Question (source)
2018-12-23 04:33:54 -0500 asked a question 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 '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!'
2018-03-10 19:48:54 -0500 received badge  Popular Question (source)
2017-11-02 04:18:10 -0500 answered a question how to print the printout not too long on Sagecell

Thank you so much...i'm new to this apps

2017-10-28 05:48:51 -0500 commented answer Can we read local file from Sagecell

Thanks a lot...

2017-10-28 05:46:55 -0500 commented answer how can SageCell read text file from url?

Thanks a lot. God bless u...

2017-10-27 12:17:30 -0500 commented question Can we read local file from Sagecell

Thank you...

2017-10-27 12:01:19 -0500 asked a question how can SageCell read text file from url?

How can SageCell read text file from url? I work on SageCell. I will read input from text file i put on http/https.

2017-10-27 09:01:43 -0500 asked a question Can we read local file from Sagecell

Can we read local file from Sagecell? I work with SageMathCell embedded on blog.

2017-10-25 00:26:03 -0500 commented answer Addition polynomial in finite field error

Thanks...nice. Sorry for x+2 was there...my mistake.it's x+1

2017-10-23 03:13:37 -0500 commented answer how to print the printout not too long on Sagecell

i cant find flowed function on sagecell...

2017-10-23 03:13:00 -0500 commented answer how to print the printout not too long on Sagecell

Thanks you so much...i like the second one...its works nice on my list. God gives u the best..

2017-10-23 03:11:43 -0500 received badge  Scholar (source)
2017-10-23 03:11:39 -0500 received badge  Supporter (source)
2017-10-22 22:34:16 -0500 received badge  Student (source)
2017-10-22 05:58:38 -0500 asked a question What is the difference between cardinality and order in Elliptic Curve

What is the difference between cardinality and order in Elliptic Curve GF(Prime)

F = GF(251)
E = EllipticCurve(F,[0,0,0,0,7])
G = E.gen(0)
cAr = E.cardinality()
oRd = E.order()
2017-10-21 23:13:55 -0500 commented answer how to print the printout not too long on Sagecell

what about the number of list is odd? I have tried this below, but still not work.

myList = []
for i in range (67):
    myList.append(i)
L = len(myList)

num_rows=L//8
for i in range(num_rows):
    print [myList[i*L//num_rows+j] for j in range(L//num_rows)]
2017-10-21 10:01:06 -0500 asked a question how to print the printout not too long on Sagecell

I try to printout this.

myList = []
for i in range (64):
    myList.append(i)
print myList

Result:

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]

What i need is like below

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]

Someone help me pls...

2017-10-20 01:39:59 -0500 asked a question OverflowError: Python int too large to convert to C long in computing Elliptic Curve points

When i tried to compute number of points of Elliptic Curve, I had a error OverflowError: Python int too large to convert to C long. What should i do? Here the code :

p = 2^256 - 2^32 - 2^9 - 2^8 - 2^7 - 2^6 - 2^4 - 1
F = GF(p)
E = EllipticCurve(F,[0,0,0,0,7])
print E.points()
2017-10-18 22:23:36 -0500 commented answer Addition polynomial in finite field error

ty so much...but i need the result in x, not in y.

2017-10-18 10:59:38 -0500 answered a question Addition polynomial in finite field error

Thanks, but what happen with my code below:

R.<x> = GF(2)[]                          
K.<x> = GF(2^3, modulus=x^3+x+1)

M = MatrixSpace(ZZ['x'],8,8)
def add(a, b):
    ab = []
    for i in range(0, len(a)):
        for j in range(0,len(b)):
            ab.append(a[i]+b[j])
    return ab

a=[0,1,x,x+2,x^2,x^2+1,x^2+x,x^2+x+1]
b=[0,1,x,x+2,x^2,x^2+1,x^2+x,x^2+x+1]
result=M(add(a, b))
print 'Modulus used:',K.modulus()
print result

the result 1 + 1 still 2, when i dont use R.<x> = GF(2)[], my code get error... Now, my solution just not used 1. I used x^0 for replacing 1

2017-10-18 10:49:46 -0500 received badge  Editor (source)
2017-10-17 10:59:59 -0500 asked a question Addition polynomial in finite field error

I try to do some additions with finite field (GF) just like below. What happen with A?

R.<x> = GF(2)[]
K.<x> = GF(2^8, modulus=x^8 + x^4 + x^3 + x + 1)
A = 1 + 1
B = x + x
C = x + x^2
print A
print B
print C

Result:
2 
0
x^2 + x