Class: BitcoinCigs::EcKey

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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_keyObject

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_keyObject

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

#secretObject

Returns the value of attribute secret.



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

def secret
  @secret
end