Class: BLS::Fr

Inherits:
Object
  • Object
show all
Includes:
Field
Defined in:
lib/bls/field.rb

Overview

Finite field over r.

Constant Summary collapse

ORDER =
BLS::Curve::R
ZERO =
Fr.new(0)
ONE =
Fr.new(1)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Field

#==, #add, #div, #invert, #multiply, #negate, #pow, #square, #subtract, #to_s, #zero?

Constructor Details

#initialize(value) ⇒ Fr

Returns a new instance of Fr.

Raises:

  • (ArgumentError)


109
110
111
112
113
# File 'lib/bls/field.rb', line 109

def initialize(value)
  raise ArgumentError, 'value must be Integer.' unless value.is_a?(Integer)

  @value = BLS.mod(value, ORDER)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



107
108
109
# File 'lib/bls/field.rb', line 107

def value
  @value
end