Class: BitcoinCigs::EcKey
- Inherits:
-
Object
- Object
- BitcoinCigs::EcKey
- Defined in:
- lib/bitcoin_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/bitcoin_cigs/ec_key.rb', line 5 def initialize(secret, compressed = false) curve = ::BitcoinCigs::CurveFp.new(BitcoinCigs::P, BitcoinCigs::A, BitcoinCigs::B) generator = Point.new(curve, BitcoinCigs::Gx, BitcoinCigs::Gy, BitcoinCigs::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/bitcoin_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/bitcoin_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/bitcoin_cigs/ec_key.rb', line 3 def secret @secret end |