Class BSV::Primitives::PointInFiniteField ¶
Inherits: Object
A point (x, y) in a finite field over the secp256k1 field prime P.
Used as a share in Shamir's Secret Sharing Scheme. Both coordinates are reduced modulo P on construction so they always lie in [0, P).
Serialisation uses Base58 for each coordinate, joined by a dot, matching the format used by the Go and TypeScript reference SDKs.
@example
point = PointInFiniteField.new(OpenSSL::BN.new(10), OpenSSL::BN.new(20))
str = point.to_s #=> "C.N"
back = PointInFiniteField.from_string(str)
Constants¶
P ¶
The secp256k1 field prime P.
Attributes¶
x [R] ¶
- @return [OpenSSL::BN] the x-coordinate, reduced mod P
y [R] ¶
- @return [OpenSSL::BN] the y-coordinate, reduced mod P
Public Class Methods¶
from_string(str) ¶
Deserialise from a "Base58(x).Base58(y)" string. - @param str [String] dot-separated Base58-encoded coordinates - @raise [ArgumentError] if the string does not contain exactly one dot - @return [PointInFiniteField]
Public Instance Methods¶
initialize(x, y) ¶
- @param
x[OpenSSL::BN] the x-coordinate - @param
y[OpenSSL::BN] the y-coordinate - @return [PointInFiniteField] a new instance of PointInFiniteField
to_s() ¶
Serialise to Base58(x) + "." + Base58(y). - @return [String] dot-separated Base58-encoded coordinates