Class: BitcoinCigs::CurveFp
- Inherits:
-
Object
- Object
- BitcoinCigs::CurveFp
- Defined in:
- lib/bitcoin_cigs/curve_fp.rb
Instance Attribute Summary collapse
-
#a ⇒ Object
Returns the value of attribute a.
-
#b ⇒ Object
Returns the value of attribute b.
-
#p ⇒ Object
Returns the value of attribute p.
Instance Method Summary collapse
- #contains_point(x, y) ⇒ Object
-
#initialize(p, a, b) ⇒ CurveFp
constructor
A new instance of CurveFp.
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
#a ⇒ Object
Returns the value of attribute a.
3 4 5 |
# File 'lib/bitcoin_cigs/curve_fp.rb', line 3 def a @a end |
#b ⇒ Object
Returns the value of attribute b.
3 4 5 |
# File 'lib/bitcoin_cigs/curve_fp.rb', line 3 def b @b end |
#p ⇒ Object
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 |