Class: ECC::Curve

Inherits:
Object
  • Object
show all
Defined in:
lib/elliptic-lite/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(a:, b:, f: IntegerOp) ⇒ Curve

field (operations type) class



25
26
27
28
29
# File 'lib/elliptic-lite/base.rb', line 25

def initialize( a:, b:, f: IntegerOp ) ## field (operations type) class
  @a  = a
  @b  = b
  @f  = f
end

Instance Attribute Details

#aObject (readonly)

Returns the value of attribute a.



23
24
25
# File 'lib/elliptic-lite/base.rb', line 23

def a
  @a
end

#bObject (readonly)

Returns the value of attribute b.



23
24
25
# File 'lib/elliptic-lite/base.rb', line 23

def b
  @b
end

#fObject (readonly)

Returns the value of attribute f.



23
24
25
# File 'lib/elliptic-lite/base.rb', line 23

def f
  @f
end

Instance Method Details

#==(other) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/elliptic-lite/base.rb', line 36

def ==(other)
  if other.is_a?( Curve ) && field?( other )
    self.a == other.a && self.b == other.b
  else
    false
  end
end

#field?(other) ⇒ Boolean

matching field (operations type) class?

Returns:

  • (Boolean)


32
33
34
# File 'lib/elliptic-lite/base.rb', line 32

def field?( other )   ## matching field (operations type) class?
  @f == other.f
end