View Source Caustic.ECPoint (Caustic v0.1.25)
Represents an elliptic curve point y^2 = x^3 + ax + b
.
Link to this section Summary
Functions
Addition of points in an elliptic curve.
Check whether two points in an elliptic field is equal.
Find points on an elliptic curve.
Create point of infinity in an elliptic curve y^2 = x^3 + ax + b.
Create a point in an elliptic field.
Examples
iex> p = 223
iex> a = {0, p}
iex> b = {7, p}
iex> x = {47, p}
iex> y = {71, p}
iex> g = Caustic.ECPoint.make(x, y, a, b)
iex> Caustic.ECPoint.mul(2, g)
{{36, 223}, {111, 223}, {0, 223}, {7, 223}}
iex> g = {{15, 223}, {86, 223}, {0, 223}, {7, 223}}
iex> Caustic.ECPoint.mul(0, g)
{nil, nil, {0, 223}, {7, 223}}
Check whether two points in an elliptic field is not equal.
Link to this section Functions
Addition of points in an elliptic curve.
examples
Examples
iex> Caustic.ECPoint.add(Caustic.ECPoint.make(-1, -1, 5, 7), Caustic.ECPoint.infinity(5, 7))
{-1, -1, 5, 7}
iex> Caustic.ECPoint.add(Caustic.ECPoint.infinity(5, 7), Caustic.ECPoint.make(-1, -1, 5, 7))
{-1, -1, 5, 7}
iex> Caustic.ECPoint.add(Caustic.ECPoint.make(-1, 1, 5, 7), Caustic.ECPoint.make(-1, -1, 5, 7))
{nil, nil, 5, 7}
iex> p = 223
iex> a = {0, p}
iex> b = {7, p}
iex> x1 = {192, p}
iex> y1 = {105, p}
iex> x2 = {17, p}
iex> y2 = {56, p}
iex> p1 = Caustic.ECPoint.make(x1, y1, a, b)
iex> p2 = Caustic.ECPoint.make(x2, y2, a, b)
iex> Caustic.ECPoint.add(p1, p2)
{{170, 223}, {142, 223}, {0, 223}, {7, 223}}
iex> p = 223
iex> a = {0, p}
iex> b = {7, p}
iex> x = {47, p}
iex> y = {71, p}
iex> p = Caustic.ECPoint.make(x, y, a, b)
iex> Caustic.ECPoint.add(p, p)
{{36, 223}, {111, 223}, {0, 223}, {7, 223}}
iex> a = {0, 223}
iex> b = {7, 223}
iex> i = Caustic.ECPoint.infinity(a, b)
iex> Caustic.ECPoint.add(i, i)
{nil, nil, {0, 223}, {7, 223}}
Check whether two points in an elliptic field is equal.
examples
Examples
iex> Caustic.ECPoint.eq?({-1, -1, 5, 7}, {-1, -1, 5, 7})
true
Find points on an elliptic curve.
examples
Examples
iex> Caustic.ECPoint.find_points(-100, 5, 7)
[]
iex> Caustic.ECPoint.find_points(-1.0, 5, 7)
[{-1.0, 1.0, 5, 7}, {-1.0, -1.0, 5, 7}]
Create point of infinity in an elliptic curve y^2 = x^3 + ax + b.
examples
Examples
iex> Caustic.ECPoint.infinity(5, 7)
{nil, nil, 5, 7}
Create a point in an elliptic field.
examples
Examples
iex> Caustic.ECPoint.make(-1, 1, 5, 7)
{-1, 1, 5, 7}
iex> Caustic.ECPoint.make(-1, -1, 5, 7)
{-1, -1, 5, 7}
iex> Caustic.ECPoint.make({17, 103}, {64, 103}, {0, 103}, {7, 103})
{{17, 103}, {64, 103}, {0, 103}, {7, 103}}
iex> Caustic.ECPoint.make({192, 223}, {105, 223}, {0, 223}, {7, 223})
{{192, 223}, {105, 223}, {0, 223}, {7, 223}}
iex> Caustic.ECPoint.make({17, 223}, {56, 223}, {0, 223}, {7, 223})
{{17, 223}, {56, 223}, {0, 223}, {7, 223}}
examples
Examples
iex> p = 223
iex> a = {0, p}
iex> b = {7, p}
iex> x = {47, p}
iex> y = {71, p}
iex> g = Caustic.ECPoint.make(x, y, a, b)
iex> Caustic.ECPoint.mul(2, g)
{{36, 223}, {111, 223}, {0, 223}, {7, 223}}
iex> g = {{15, 223}, {86, 223}, {0, 223}, {7, 223}}
iex> Caustic.ECPoint.mul(0, g)
{nil, nil, {0, 223}, {7, 223}}
Check whether two points in an elliptic field is not equal.
examples
Examples
iex> Caustic.ECPoint.ne?({-1, 1, 5, 7}, {-1, -1, 5, 7})
true