Class: CryptoGost3410::Generator
- Inherits:
-
Object
- Object
- CryptoGost3410::Generator
- Defined in:
- lib/crypto_gost3410/generator.rb
Overview
DigitalSignature
Instance Attribute Summary collapse
-
#group ⇒ Object
readonly
Returns the value of attribute group.
Instance Method Summary collapse
-
#initialize(group) ⇒ Generator
constructor
A new instance of Generator.
- #sign(hash, private_key, rand_val) ⇒ Object
- #vko(ukm, private_key, other_public_key) ⇒ Object
Constructor Details
#initialize(group) ⇒ Generator
Returns a new instance of Generator.
8 9 10 |
# File 'lib/crypto_gost3410/generator.rb', line 8 def initialize(group) @group = group end |
Instance Attribute Details
#group ⇒ Object (readonly)
Returns the value of attribute group.
6 7 8 |
# File 'lib/crypto_gost3410/generator.rb', line 6 def group @group end |
Instance Method Details
#sign(hash, private_key, rand_val) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/crypto_gost3410/generator.rb', line 12 def sign(hash, private_key, rand_val) @hash = hash @private_key = private_key @rnd = rand_val @r = r_func s = s_func CryptoGost3410::Point.new self, [@r, s] end |
#vko(ukm, private_key, other_public_key) ⇒ Object
21 22 23 24 |
# File 'lib/crypto_gost3410/generator.rb', line 21 def vko(ukm, private_key, other_public_key) n = (group.opts[:h] * private_key * ukm) % group.order other_public_key * n end |