class Ed25519::Point
- Ed25519::Point
- Reference
- Object
Overview
** Default Point works in affine coordinates: (x, y) /
Defined in:
ed25519/point.crConstant Summary
-
BASE =
Point.new(Ed25519::Curve::Gx, Ed25519::Curve::Gy)
-
Base point aka generator public_key = Point::BASE * private_key
-
ZERO =
Point.new(Zero, One)
-
Identity point aka point at infinity point = point + zero_point
Constructors
Class Method Summary
-
.from_hex(hex : Hex, strict = true)
Converts hash string or Bytes to Point.
- .from_private_key(private_key : PrivKey)
Instance Method Summary
- #==(other : Point) : Bool
-
#_set_window_size(window_size : Int32)
"Private method", don't use it directly.
-
#_window_size : Int32
We calculate precomputes for elliptic curve point multiplication using windowed method.
-
#_window_size=(_window_size : Int32)
We calculate precomputes for elliptic curve point multiplication using windowed method.
- #add(other : Point)
- #equals(other : Point) : Bool
-
#finialize
Note: This method is not in the original typescript implementation.
- #is_torsion_free : Bool
-
#multiply(scalar : Int) : Point
** Constant time multiplication.
- #negate
- #subtract(other : Point)
-
#to_hex : String
Same as to_raw_bytes, but returns string.
-
#to_raw_bytes : Bytes
There can always be only two x values (x, -x) for any y When compressing point, it's enough to only store its y coordinate and use the last byte to encode sign of x.
-
#to_x25519 : Bytes
** Converts to Montgomery aka x coordinate of curve25519.
- #x : BigInt
- #x=(x : BigInt)
- #y : BigInt
- #y=(y : BigInt)
Constructor Detail
Class Method Detail
Converts hash string or Bytes to Point. Uses algo from RFC8032 5.1.3.
Instance Method Detail
We calculate precomputes for elliptic curve point multiplication using windowed method. This specifies window size and stores precomputed values. Usually only base point would be precomputed.
We calculate precomputes for elliptic curve point multiplication using windowed method. This specifies window size and stores precomputed values. Usually only base point would be precomputed.
Note: This method is not in the original typescript implementation. This method only exists to retain the WeakMap semantics that were encoded in the original implementation through the use of WeakMap(Point, Array(ExtendedPoint)) in typescript.
** Constant time multiplication. @param scalar Big-Endian number @returns new point /
There can always be only two x values (x, -x) for any y When compressing point, it's enough to only store its y coordinate and use the last byte to encode sign of x.
** Converts to Montgomery aka x coordinate of curve25519. We don't have fromX25519, because we don't know sign.
u, v: curve25519 coordinates
x, y: ed25519 coordinates
(u, v) = ((1+y)/(1-y), sqrt(-486664)*u/x)
(x, y) = (sqrt(-486664)*u/v, (u-1)/(u+1))
https://blog.filippo.io/using-ed25519-keys-for-encryption @returns u coordinate of curve25519 point /