Class: DigiByteCigs::EcKey

Inherits:
Object
  • Object
show all
Defined in:
lib/digibyte_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/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_keyObject

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_keyObject

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

#secretObject

Returns the value of attribute secret.



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

def secret
  @secret
end