class Rb25519::FField::FFieldValue

Attributes

val[RW]

Public Class Methods

new(f, v) click to toggle source
# File lib/rb-pure25519.rb, line 107
def initialize(f, v)
  @field = f
  @val = v.to_i

  if @val >= @field.p  || @val < 0
    @val = @val % @field.p
  end
end

Public Instance Methods

*(v) click to toggle source
# File lib/rb-pure25519.rb, line 124
def *(v)
  FFieldValue.new(@field, @field.mul(self, v))
end
**(v) click to toggle source
# File lib/rb-pure25519.rb, line 136
def **(v)
  FFieldValue.new(@field, @field.exp(self, v))
end
+(v) click to toggle source
# File lib/rb-pure25519.rb, line 116
def +(v)
  FFieldValue.new(@field, @field.add(self, v))
end
-(v) click to toggle source
# File lib/rb-pure25519.rb, line 120
def -(v)
  FFieldValue.new(@field, @field.sub(self, v))
end
-@() click to toggle source
# File lib/rb-pure25519.rb, line 144
def -@()
  self * -1
end
/(v) click to toggle source
# File lib/rb-pure25519.rb, line 132
def /(v)
  FFieldValue.new(@field, @field.div(self, v))
end
==(v) click to toggle source
# File lib/rb-pure25519.rb, line 92
def ==(v)
  @val == v.to_i
end
f() click to toggle source
# File lib/rb-pure25519.rb, line 95
def f
  @field
end
inspect() click to toggle source
# File lib/rb-pure25519.rb, line 148
def inspect
  "#<FFieldValue_#{@field.p}: #{@val} >"
end
inv() click to toggle source
# File lib/rb-pure25519.rb, line 128
def inv
  FFieldValue.new(@field, @field.inv(self))
end
sqrt() click to toggle source
# File lib/rb-pure25519.rb, line 140
def sqrt
  @field.sqrt(self).map{|e| FFieldValue.new(@field, e) }
end
to_f() click to toggle source
# File lib/rb-pure25519.rb, line 103
def to_f
  @val.to_f
end
to_i() click to toggle source
# File lib/rb-pure25519.rb, line 99
def to_i
  @val
end
to_s() click to toggle source
# File lib/rb-pure25519.rb, line 152
def to_s
  inspect
end