Module ECP

Elliptic Curve Point Arithmetic (ECP)

Base arithmetical operations on elliptic curve point coordinates.

ECP arithmetic operations are provided to implement existing and new encryption schemes: they are elliptic curve cryptographic primitives and work the same across different curves.

It is possible to create ECP points instances using the new method. The values of each coordinate can be imported using BIG methods BIG.hex() or BIG.base64().

Once ECP numbers are created this way, the arithmetic operations of addition, subtraction and multiplication can be executed normally using overloaded operators (+ - *).

Info:

  • Copyright: Dyne.org foundation 2017-2018
  • License: GPLv3
  • Author: Denis "Jaromil" Roio

Functions

new (coordinates) Create a new ECP point from an OCTET argument containing its coordinates.
generator () Returns the generator of the curve: an ECP point that is multiplied by any BIG number to obtain a correspondent point on the curve.
infinity () Returns a new ECP infinity point that is definitely not on the curve.
order () Gives the order of the curve, a BIG number contained in an octet.
mapit (OCTET) Map an OCTET of exactly 64 bytes length to a point on the curve: the OCTET should be the output of an hash function.
validate (OCTET) Verify that an OCTET really corresponds to an ECP point on the curve.

Class ecp

ecp:affine () Make an existing ECP point affine with its curve
ecp:isinf () Returns true if an ECP coordinate points to infinity (out of the curve) and false otherwise.
ecp:add (first, second) Add two ECP points to each other (commutative and associative operation).
ecp:sub (first, second) Subtract an ECP point from another (commutative and associative operation).
ecp:negative () Transforms an ECP point into its equivalent negative point on the elliptic curve.
ecp:double () Transforms an ECP pointo into the double of its value, multiplying it by two.
ecp:mul (ecp, number) Multiply an ECP point by a BIG number.
ecp:eq (first, second) Compares two ECP objects and returns true if they indicate the same point on the curve (they are equal) or false otherwise.
ecp:octet () Returns an octet containing the coordinate of an ECP point on the curve.
ecp:x () Gives the X coordinate of the ECP point as a single BIG number.
ecp:y () Gives the Y coordinate of the ECP point as a single BIG number.


Functions

new (coordinates)
Create a new ECP point from an OCTET argument containing its coordinates. (octet)

Parameters:

  • coordinates of the point on the elliptic curve

Returns:

    a new ECP point on the curve

See also:

generator ()
Returns the generator of the curve: an ECP point that is multiplied by any BIG number to obtain a correspondent point on the curve. ()

Returns:

    ECP point of the curve's generator.
infinity ()
Returns a new ECP infinity point that is definitely not on the curve. ()

Returns:

    ECP pointing to infinity (out of the curve).
order ()
Gives the order of the curve, a BIG number contained in an octet. ()

Returns:

    a BIG number containing the curve's order
mapit (OCTET)
Map an OCTET of exactly 64 bytes length to a point on the curve: the OCTET should be the output of an hash function. (OCTET)

Parameters:

  • OCTET resulting from an hash function

Returns:

    an ECP that is univocally linked to the input OCTET
validate (OCTET)
Verify that an OCTET really corresponds to an ECP point on the curve. (OCTET)

Parameters:

  • OCTET point to be validated

Returns:

    bool value: true if valid, false if not valid

Class ecp

Instance Methods
ecp:affine ()
Make an existing ECP point affine with its curve ()

Returns:

    ECP point made affine
ecp:isinf ()
Returns true if an ECP coordinate points to infinity (out of the curve) and false otherwise. ()

Returns:

    false if point is on curve, true if its off curve into infinity.
ecp:add (first, second)
Add two ECP points to each other (commutative and associative operation). Can be made using the overloaded operator + between two ECP objects just like the would be numbers. (first,second)

Parameters:

  • first number to be summed
  • second number to be summed

Returns:

    sum resulting from the addition
ecp:sub (first, second)
Subtract an ECP point from another (commutative and associative operation). Can be made using the overloaded operator - between two ECP objects just like the would be numbers. (first,second)

Parameters:

  • first number from which the second should be subtracted
  • second number to use in the subtraction

Returns:

    new ECP point resulting from the subtraction
ecp:negative ()
Transforms an ECP point into its equivalent negative point on the elliptic curve. ()
ecp:double ()
Transforms an ECP pointo into the double of its value, multiplying it by two. This works faster than multiplying it an arbitrary number of times. ()
ecp:mul (ecp, number)
Multiply an ECP point by a BIG number. Can be made using the overloaded operator * (ecp,num)

Parameters:

  • ecp point on the elliptic curve to be multiplied
  • number indicating how many times it should be multiplied

Returns:

    new ecp point resulting from the multiplication
ecp:eq (first, second)
Compares two ECP objects and returns true if they indicate the same point on the curve (they are equal) or false otherwise. It can also be executed by using the == overloaded operator. (first,second)

Parameters:

  • first ecp point to be compared
  • second ecp point to be compared

Returns:

    bool value: true if equal, false if not equal
ecp:octet ()
Returns an octet containing the coordinate of an ECP point on the curve. It can be used to export the value of an ECP point into a string, using OCTET:hex or OCTET:base64 encapsulation. It can be decoded back to an ECP point using ECP:new. ()

Returns:

    the ECP point as an OCTET sequence
ecp:x ()
Gives the X coordinate of the ECP point as a single BIG number. ()

Returns:

    a BIG number indicating the X coordinate of the point on curve.
ecp:y ()
Gives the Y coordinate of the ECP point as a single BIG number. ()

Returns:

    a BIG number indicating the Y coordinate of the point on curve.
generated by LDoc 1.4.3 Last updated 2019-03-28 14:05:32
]==]