Class: BitcoinCigs::CurveFp

Inherits:
Object
  • Object
show all
Defined in:
lib/bitcoin_cigs/curve_fp.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(p, a, b) ⇒ CurveFp

Returns a new instance of CurveFp.



5
6
7
8
9
# File 'lib/bitcoin_cigs/curve_fp.rb', line 5

def initialize(p, a, b)
  self.p = p
  self.a = a
  self.b = b
end

Instance Attribute Details

#aObject

Returns the value of attribute a.



3
4
5
# File 'lib/bitcoin_cigs/curve_fp.rb', line 3

def a
  @a
end

#bObject

Returns the value of attribute b.



3
4
5
# File 'lib/bitcoin_cigs/curve_fp.rb', line 3

def b
  @b
end

#pObject

Returns the value of attribute p.



3
4
5
# File 'lib/bitcoin_cigs/curve_fp.rb', line 3

def p
  @p
end

Instance Method Details

#contains_point(x, y) ⇒ Object



11
12
13
# File 'lib/bitcoin_cigs/curve_fp.rb', line 11

def contains_point(x, y)
  return (y * y - (x * x * x + a * x + b)) % p == 0
end