It is calling __mul__ which is just above the __rmul__ portion of the code.
According to documentation of __rmul__ (
http://docs.python.org/3.3/reference/datamodel.html#object.__rmul__) it
just calls the implementation of __mul__ (
https://github.com/warner/python-ecdsa/blob/master/ecdsa/ellipticcurve.py#L109-138
)

HTH,
Vijay.


On Thu, Jan 30, 2014 at 12:32 PM, Raul Miller <rauldmil...@gmail.com> wrote:

> I have been looking at this, and I did a straightforward conversion of
> the python code to J (not quite complete). And I have a couple issues
> I would like to talk through before proceeding (I've also not yet
> studied Cliff Reiter's code).
>
> First, I would like to quibble with what I assume is the underlying
> standards document. The value INFINITY behaves like a zero in the
> context of addition. That strikes me as a bit odd.
>
> Second, though, I would like to understand python's rules a bit better
> - what happens when one multiples a Point with integer?
>
> Specifically, consider this excerpt from
> https://github.com/warner/python-ecdsa/blob/master/ecdsa/ellipticcurve.py
> :
>
>   p192 = Point( c192, Gx, Gy, r )
>
>   # Checking against some sample computations presented
>   # in X9.62:
>
>   d = 651056770906015076056810763456358567190100156695615665659
>   Q = d * p192
>
> The definitions of p192 and d are trivial for me to translate:
>
>   p192=. (c192;Gx;Gy;r) conew 'Point'
>
>   d=. 651056770906015076056810763456358567190100156695615665659x
>
> But how do I translate Q?
>
> In the definition of Point, I saw the following bit of python:
>
>   def __rmul__( self, other ):
>     """Multiply a point by an integer."""
>
>     return self * other
>
> But if that is the relevant code, all it is telling me is that
> multiplication is defined in terms of multiplication - as far as I can
> see, there is no other definition for multiplying a Point and an
> integer, nor have I seen any constructor for constructing a Point from
> an integer.
>
> Before I spend too much time chasing down rabbit holes (I really
> should be working on some other issues), can someone explain to me
> what is supposed to happen here?
>
> Thanks,
>
> --
> Raul
>
> On Wed, Jan 29, 2014 at 11:35 AM, Pascal Jasmin <godspiral2...@yahoo.ca>
> 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
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to