class CryptoGost3410::Generator

DigitalSignature

@author vblazhnovgit

Attributes

group[R]

Public Class Methods

new(group) click to toggle source
# File lib/crypto_gost3410/generator.rb, line 8
def initialize(group)
  @group = group
end

Public Instance Methods

sign(hash, private_key, rand_val) click to toggle source
# 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) click to toggle source
# 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

Private Instance Methods

r_func() click to toggle source
# File lib/crypto_gost3410/generator.rb, line 28
def r_func
  (group.generator * @rnd).x % group.order
end
s_func() click to toggle source
# File lib/crypto_gost3410/generator.rb, line 32
def s_func
  (@r * @private_key + @rnd * @hash) % group.order
end