Method: Ccrypto::Ruby::ShamirSharing#initialize

Defined in:
lib/ccrypto/ruby/engines/secret_sharing_engine.rb

#initialize(threshold, secretdata = nil) ⇒ ShamirSharing

Returns a new instance of ShamirSharing.


57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/ccrypto/ruby/engines/secret_sharing_engine.rb', line 57

def initialize(threshold, secretdata=nil)
  @threshold = threshold
  @secretdata = secretdata
  @_coefficients = []

  if secretdata
    secretdata.each_char do |secretbyte|
      thesecoefficients = secretbyte+OpenSSL::Random.random_bytes(@threshold-1)
      @_coefficients << thesecoefficients
    end
  end
end