Skip to content
This repository has been archived by the owner on Aug 28, 2019. It is now read-only.

Commit

Permalink
Trim down the args for recover_secret to what is actually needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
grempe committed Dec 24, 2013
1 parent c6464c2 commit ce71f1a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/secretsharing/shamir/container.rb
Expand Up @@ -86,7 +86,7 @@ def <<(share)

share = SecretSharing::Shamir::Share.new(:share => share) unless share.is_a?(SecretSharing::Shamir::Share)
@shares << share unless @shares.include?(share)
@secret = Share.recover_secret(@shares, @secret, @k)
@secret = Share.recover_secret(@shares)
end
end # class Container
end # module Shamir
Expand Down
4 changes: 2 additions & 2 deletions lib/secretsharing/shamir/share.rb
Expand Up @@ -100,8 +100,8 @@ def self.create_shares(k, n, secret)
end

# Recover the secret by doing Lagrange interpolation.
def self.recover_secret(shares, secret, k)
return false unless shares.length >= k
def self.recover_secret(shares)
return false unless shares.length >= shares[0].k

# All Shares must have the same HMAC or they were derived from different Secrets
hmacs = shares.map { |s| s.hmac }.uniq
Expand Down

0 comments on commit ce71f1a

Please sign in to comment.