class Ed25519::ExtendedPoint
- Ed25519::ExtendedPoint
- Reference
- Object
Overview
Extended Point works in extended coordinates: (x, y, z, t) ∋ (x=x/z, y=y/z, t=xy). Default Point works in affine coordinates: (x, y) https://en.wikipedia.org/wiki/Twisted_Edwards_curve#Extended_coordinates
Defined in:
ed25519/extended_point.crConstant Summary
-
BASE =
ExtendedPoint.new(Curve::Gx, Curve::Gy, One, Ed25519.mod(Curve::Gx * Curve::Gy))
-
ZERO =
ExtendedPoint.new(Zero, One, One, Zero)
Constructors
Class Method Summary
- .normalize_z(points : Array(ExtendedPoint)) : Array(ExtendedPoint)
-
.to_affine_batch(points : Array(ExtendedPoint)) : Array(Point)
Takes a bunch of Jacobian Points but executes only one invert on all of them.
Instance Method Summary
- #==(other : ExtendedPoint) : Bool
-
#add(other : ExtendedPoint)
Fast algo for adding 2 Extended Points when curve's a=-1.
-
#double : ExtendedPoint
Fast algo for doubling Extended Point when curve's a=-1.
-
#equals(other : ExtendedPoint) : Bool
Compare one point to another.
- #is_small_order : Bool
- #is_torsion_free : Bool
-
#multiply(scalar : Int, affine_point : Point | Nil) : ExtendedPoint
Constant time multiplication.
-
#multiply_unsafe(scalar : Int) : ExtendedPoint
Non-constant-time multiplication.
-
#negate : ExtendedPoint
Inverses point to one corresponding to (x, -y) in Affine coordinates.
- #subtract(other : ExtendedPoint) : ExtendedPoint
- #t : BigInt
- #t=(t : BigInt)
-
#to_affine(inv_z : BigInt = Ed25519.invert(@z)) : Point
Converts Extended point to default (x, y) coordinates.
- #x : BigInt
- #x=(x : BigInt)
- #y : BigInt
- #y=(y : BigInt)
- #z : BigInt
- #z=(z : BigInt)
Constructor Detail
Class Method Detail
Takes a bunch of Jacobian Points but executes only one invert on all of them. invert is very slow operation, so this improves performance massively.
Instance Method Detail
Fast algo for adding 2 Extended Points when curve's a=-1.
http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-4
Cost: 8M + 8add + 2*2.
Note: It does not check whether the other
point is valid.
Fast algo for doubling Extended Point when curve's a=-1. http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#doubling-dbl-2008-hwcd Cost: 3M + 4S + 1a + 7add + 12.
Constant time multiplication. Uses w_naf method. Windowed method may be 10% faster, but takes 2x longer to generate and consumes 2x memory.
Non-constant-time multiplication. Uses double-and-add algorithm. It's faster, but should only be used when you don't care about an exposed private key e.g. sig verification. Allows scalar bigger than curve order, but less than 2^256
Converts Extended point to default (x, y) coordinates. Can accept precomputed Z^-1 - for example, from invert_batch.