ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 23 Dec 2018 11:33:54 +0100discrete_log_rho OverflowError: Python int too large to convert to C longhttps://ask.sagemath.org/question/44756/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!'NiyamabrataSun, 23 Dec 2018 11:33:54 +0100https://ask.sagemath.org/question/44756/Change Precision of complex_roots()https://ask.sagemath.org/question/39987/change-precision-of-complex_roots/I am trying to find the complex roots of the polynomial
poly = x^7 - 6*x^6 + 15*x^5 - 20*x^4 + 15*x^3 - 6*x^2 + x
But when I do poly.complex_roots(), the system gives:
PariError: overflow in expo()
Apparently there are options for how much precision you want when computing roots -- one option is to use Pari, which is the high-precision option, and the other NumPy, which is the low-precision option. The default is set to use Pari, which apparently overloads when I try to compute the roots of this polynomial (and many others as well, this polynomial is just one example).
How do I change the complex_roots() function to get lower-precision roots?cshiringThu, 07 Dec 2017 06:10:52 +0100https://ask.sagemath.org/question/39987/Change Precision on complex_roots()https://ask.sagemath.org/question/39988/change-precision-on-complex_roots/ I am trying to find the complex roots of the polynomial
poly = x^7 - 6*x^6 + 15*x^5 - 20*x^4 + 15*x^3 - 6*x^2 + x
But when I do poly.complex_roots(), the system gives:
PariError: overflow in expo()
Apparently there are options for how much precision you want when computing roots -- one option is to use Pari, which is the high-precision option, and the other NumPy, which is the low-precision option. The default is set to use Pari, which apparently overloads when I try to compute the roots of this polynomial (and many others as well, this polynomial is just one example).
How do I change the complex_roots() function to get lower-precision roots?
Alternatively, how do I deal with the PariError?
cshiringThu, 07 Dec 2017 06:13:28 +0100https://ask.sagemath.org/question/39988/Overflow when defining points on elliptic curvehttps://ask.sagemath.org/question/36709/overflow-when-defining-points-on-elliptic-curve/I have the following elliptic curve in SAGE:
p1 = 2^256-189
E10 = EllipticCurve(GF(p1),[-3,0])
I want to find points of different orders and multiply them with a number. However when I try to get SAGE to define or print a point like P=E10.points()[19] I get the following error:
Error in lines 1-1
Traceback (most recent call last):
File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 982, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/ell_finite_field.py", line 214, in points
v = self._points_via_group_structure()
File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/ell_finite_field.py", line 156, in _points_via_group_structure
for m in range(1,ni[0]):
OverflowError: Python int too large to convert to C long
So far I have only suceeded in finding the point (0,0) of order 2 but I also need points of higher order. Is there any way to fix this overflow error or find points of different orders that SAGE can actually handle without getting overflow or is my curve just impossible to work with?
I started out trying to print the list of all points and their orders but that resulted in the error. Then I tried printing only one point and now I am simply trying to define the points without printing them (however I need to print k*P for some k later on for all the points).
I got the point (112810383992036387042877104932833846002363090508032041943368137894367452952778,85347934490306136025376423714596250175969011873639765034628869535783033211301) using `E10.gens()` but I can't define it getting the error:
ValueError: libGAP: Error, E: <n> must be a positive integer (not a integer (>= 2^60))
So I am suspecting that it is not possible to get any useful points on this curve. If so can anyone explain to me why it is so (with some references if possible)?AliceThu, 23 Feb 2017 13:27:27 +0100https://ask.sagemath.org/question/36709/NIST B-283 Elliptic Curvehttps://ask.sagemath.org/question/8736/nist-b-283-elliptic-curve/I'm new to Sage so forgive me if this is simple. I am trying to define the NIST B-283 elliptic curve as follows:
def B283_test():
order = 2**283
a = 1
b = 0x027B680AC8B8596DA5A4AF8A19A0303FCA97FD7645309FA2A581485AF6263E313B79A2F5
K.<x>= GF(2)[]
K.<a> = GF(order=order, name='a', modulus=x^283 + x^12 + x^7 + x^5 + 1 )
B283_curve = EllipticCurve(K, [1,a,0,0,b])
I get a fairly long traceback after the last line followed by:
OverflowError: long int too large to convert to int
Any help is appreciated.MichaelJThu, 23 Feb 2012 22:28:29 +0100https://ask.sagemath.org/question/8736/