class CryptoGost::Group

Group

@author WildDima

Constants

NAMES
Nistp192
Nistp224
Nistp256
Nistp384
Nistp521
Secp112r1
Secp112r2
Secp128r1
Secp128r2
Secp160k1
Secp160r1
Secp160r2
Secp192k1
Secp192r1
Secp224k1
Secp224r1
Secp256k1
Secp256r1
Secp384r1
Secp521r1

Attributes

a[R]
b[R]
generator[R]
gx[R]
gy[R]
opts[R]
order[R]
p[R]

Public Class Methods

new(opts) click to toggle source
# File lib/crypto_gost/group.rb, line 11
def initialize(opts)
  @opts = opts
  @name = opts.fetch(:name)
  @p = opts[:p]
  @a = opts[:a]
  @b = opts[:b]
  @gx = opts[:gx]
  @gy = opts[:gy]
  @order = opts[:n]
  @cofactor = opts[:h]
  @generator = CryptoGost::Point.new self, [gx, gy]
end

Public Instance Methods

generate_private_key() click to toggle source
# File lib/crypto_gost/group.rb, line 55
def generate_private_key
  1 + SecureRandom.random_number(order - 1)
end
generate_public_key(private_key) click to toggle source
# File lib/crypto_gost/group.rb, line 51
def generate_public_key(private_key)
  generator * private_key
end