thank you,
some exploration/toy code for eliptic curves:
CurvePoints =: 4 : 0"1 0
'p a b' =. x
p | %: (b + ^&3 + a&*) y
)
intCurvePointsX =: (] #~ CurvePoints = <.@CurvePoints)
intCurvePointsY =: ([ CurvePoints intCurvePointsX)
NB. x is prime, a, b defining curve: y^2 = x^3 +ax + b mod prime
NB. y is x,y point. Returns 1 if on curve. 0 otherwise.
isCurvePoint =: (4 : 0)"1
'p a b' =. x
0=p| (*:@{. - b + (a * {:) + ^&3@{:) y
)
23 23 1 intCurvePointsX i.500
0 1 15 35
23 23 1 intCurvePointsY i.50
1 5 15 2
NB. list of y;x that are integer points on curve. Not sure how to get this
info without intermediate boxing as below.
> 23 23 1 ((i.23) ; each [: I. each [: <"1 isCurvePoint) (i.23) ,."0 1 (i.40)
┌──┬─────┐
│0 │22 │
├──┼─────┤
│1 │0 23 │
├──┼─────┤
│2 │12 35│
├──┼─────┤
│3 │2 25 │
├──┼─────┤
│4 │21 │
├──┼─────┤
│5 │1 24 │
├──┼─────┤
│6 │13 36│
├──┼─────┤
│7 │16 39│
├──┼─────┤
│8 │15 38│
├──┼─────┤
│9 │10 33│
├──┼─────┤
│10│14 37│
├──┼─────┤
│11│19 │
├──┼─────┤
│12│19 │
├──┼─────┤
│13│14 37│
├──┼─────┤
│14│10 33│
├──┼─────┤
│15│15 38│
├──┼─────┤
│16│16 39│
├──┼─────┤
│17│13 36│
├──┼─────┤
│18│1 24 │
├──┼─────┤
│19│21 │
├──┼─────┤
│20│2 25 │
├──┼─────┤
│21│12 35│
├──┼─────┤
│22│0 23 │
└──┴─────┘
----- Original Message -----
From: Cliff Reiter <[email protected]>
To: [email protected]
Cc:
Sent: Wednesday, January 29, 2014 3:32:21 PM
Subject: Re: [Jprogramming] math requests
Some elliptic curve stuff; I think there is a +1 error that Roger Hui
noticed in the factorization method.
http://archive.vector.org.uk/art10007270
http://archive.vector.org.uk/art10007280
Best, Cliff
On 1/29/2014 11:35 AM, Pascal Jasmin wrote:
>
> With all of the mathematicians on this list, these functions have likely been
> implemented before in J.
>
> elyptic curve point add, multiplication and double
> a python reference implementation:
> https://github.com/warner/python-ecdsa/blob/master/ecdsa/ellipticcurve.py
>
> the functions are: __add__ __mul__ and double
>
> if I may suggest J explicit signatures for the first 2 functions as:
>
> F =: 4 : 0
> 'yx yy yo' =. y
> 'xx xy xo' =. x
> )
>
> Some other methods than the python reference could be considered here:
>
> http://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication
>
>
> also appreciated if you have in implementation of inverse_mod
> for reference function of same nate at:
> https://github.com/warner/python-ecdsa/blob/master/ecdsa/numbertheory.py
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Clifford A. Reiter
Lafayette College, Easton, PA 18042
http://webbox.lafayette.edu/~reiterc/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm