Class: ECDSA::Point

Inherits:
Object
  • Object
show all
Defined in:
lib/schnorr/ec_point_ext.rb

Instance Method Summary collapse

Instance Method Details

#encode(only_x = false) ⇒ Object

Encode this point into a binary string.

Parameters:

  • only_x (Boolean) (defaults to: false)

    whether or not to encode only X-coordinate. default is false.



13
14
15
16
17
18
19
# File 'lib/schnorr/ec_point_ext.rb', line 13

def encode(only_x = false)
  if only_x
    ECDSA::Format::FieldElementOctetString.encode(x, group.field)
  else
    ECDSA::Format::PointOctetString.encode(self, {compression: true})
  end
end

#has_even_y?Boolean

Check the y-coordinate of this point is an even.

Returns:

  • (Boolean)

    if even, return true.



7
8
9
# File 'lib/schnorr/ec_point_ext.rb', line 7

def has_even_y?
  y.even?
end