Class: DigiByteCigs::EcKey
- Inherits:
-
Object
- Object
- DigiByteCigs::EcKey
- Defined in:
- lib/digibyte_cigs/ec_key.rb
Instance Attribute Summary collapse
-
#private_key ⇒ Object
Returns the value of attribute private_key.
-
#public_key ⇒ Object
Returns the value of attribute public_key.
-
#secret ⇒ Object
Returns the value of attribute secret.
Instance Method Summary collapse
-
#initialize(secret, compressed = false) ⇒ EcKey
constructor
A new instance of EcKey.
Constructor Details
#initialize(secret, compressed = false) ⇒ EcKey
Returns a new instance of EcKey.
5 6 7 8 9 10 11 |
# File 'lib/digibyte_cigs/ec_key.rb', line 5 def initialize(secret, compressed = false) curve = ::DigiByteCigs::CurveFp.new(DigiByteCigs::P, DigiByteCigs::A, DigiByteCigs::B) generator = Point.new(curve, DigiByteCigs::Gx, DigiByteCigs::Gy, DigiByteCigs::R) self.public_key = PublicKey.new(generator, generator * secret, compressed) self.private_key = PrivateKey.new(public_key, secret) self.secret = secret end |
Instance Attribute Details
#private_key ⇒ Object
Returns the value of attribute private_key.
3 4 5 |
# File 'lib/digibyte_cigs/ec_key.rb', line 3 def private_key @private_key end |
#public_key ⇒ Object
Returns the value of attribute public_key.
3 4 5 |
# File 'lib/digibyte_cigs/ec_key.rb', line 3 def public_key @public_key end |
#secret ⇒ Object
Returns the value of attribute secret.
3 4 5 |
# File 'lib/digibyte_cigs/ec_key.rb', line 3 def secret @secret end |