Ask Your Question

panther's profile - activity

2020-05-28 17:55:50 +0100 received badge  Popular Question (source)
2020-01-23 21:27:38 +0100 received badge  Famous Question (source)
2020-01-13 03:52:00 +0100 received badge  Famous Question (source)
2019-12-02 17:38:56 +0100 received badge  Notable Question (source)
2019-12-02 17:38:56 +0100 received badge  Popular Question (source)
2019-11-30 22:25:59 +0100 received badge  Notable Question (source)
2019-11-22 19:59:09 +0100 asked a question Error: Tried to use Sage's Python which was not yet installed.

I get the following error when I try to run Sage.

  $ sage
  Error: Tried to use Sage's Python which was not yet installed.
  If this was called from an spkg-install script for another package you should add $(PYTHON) as a dependency in build/pkgs/<pkg>/dependencies

I am using MAC. I did install both Python2 and Python3. I also upgraded my python to latest versions using

  $ brew upgrade python@3
  $ brew upgrade python@2

I do not understand the problem. Please help me.

2019-09-27 21:09:40 +0100 received badge  Popular Question (source)
2019-05-30 15:36:51 +0100 commented answer Why is exponentiation of points on elliptic curve so fast?

It took around 5 seconds for executing G = E.abelian_group(). But after that is done, for the exponentiation is taking very less time. I don't see any reason how exponentiation could be done so fast. Here is my output for your code. Time per operation = 2.93278694153e-06 seconds Time per operation = 2.42040157318e-06 seconds

2019-05-30 05:51:44 +0100 received badge  Editor (source)
2019-05-30 05:50:46 +0100 asked a question Why is exponentiation of points on elliptic curve so fast?

I am working on elliptic curves in sagemath. I was trying to collect benchmarks for group operation and exponentiation of points on NIST P-256 elliptic curve. When I tried to perform a group operation on 2 points on the curve, it takes roughly 2 micro seconds. When I tried to perform exponentiation on a point in elliptic curve with a random exponent, it takes only 3 micro seconds. How is this even possible? Since I am exponentiating with a 256 bit value, this should at least take time required for 256 group operations, which is more than 1ms. I am worried if my code is wrong!

p = 115792089210356248762697446949407573530086143415290314195533631308867097853951 
order = 115792089210356248762697446949407573529996955224135760342422259061068512044369 
b = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b 
F = GF(p) 
E = EllipticCurve(F, [-3,b]) 
runs = 10000 
G = E.abelian_group()

F2 = GF(order) 
exponent = [F2.random_element() for i in range(runs)]

t1 = time() 
for i in range(runs):   
      e = Integer(exponent[i])*e2[i] 
t2 = time() 
print  "Time per operation = ", (t2 - t1)/runs , " seconds"

e1 = [G.random_element() for i in range(runs)] 
e2 = [G.random_element() for i in range(runs)] 
t1 = time() 
for i in range(runs):   
         e = e1[i]+e2[i] 
t2 = time() 
print  "Time per operation = ", (t2 - t1)/runs , " seconds"
2019-05-12 03:26:27 +0100 asked a question How to implement pairings on MNT curves?

I have used elliptic curves in sagemath. But I do not how to use pairings in sagemath.

I found a list of MNT curves at

I also found some documentation on elliptic curves at

It provides ate_pairing, tate_pairing, weil_pairing functions. I don't know which one to use. I couldn't understand it. I do not know math behind pairings well enough. Please provide a simple code for performing pairing operations on these curves.

2018-12-24 17:02:56 +0100 received badge  Supporter (source)
2018-12-24 00:32:36 +0100 asked a question Randomly generate a safe prime of given length

A prime p is said to be safe prime if (p-1)/2 is also a prime. Safe primes are heavily used in cryptography. In order to generate a random prime of 512 bits, I use

random_prime(2^512-1, false, 2^511)

How to randomly generate a safe prime of given length?

2018-12-03 13:18:39 +0100 received badge  Scholar (source)
2018-12-03 11:38:55 +0100 asked a question Get bit representation of an elliptic curve group element

I can define an elliptic curve using

E = EllipticCurve(GF(97), [2,3])

I can then compute a group on E using

G = E.abelian_group()

I can then sample a random element in the group using

R = G.random_element()

Is there a way I can get a bit string representation of this group element R? Actually, I am implementing a pseudo-random generator scheme, which finally outputs a group element on elliptic curve. I need to convert it to a bit string.

2018-11-29 18:08:40 +0100 asked a question log base 2 in sagemath

How to compute log base 2 in sagemath? I tried log(1000,2). It answers log(1000)/log(2). I want an exact numerical answer.

2018-11-28 10:58:23 +0100 received badge  Student (source)
2018-11-28 07:34:28 +0100 asked a question generate random elliptic curve of prime order

As required in many cryptographic algorithms, I would like to sample a group (in this case, an abelian group defined on elliptic curve) of a random prime order. I know how to define an elliptic curve with given parameters, and then calculate its order. But how to sample an elliptic curve of random prime order?