Documentation improvements, code cleaned up #2

Merged
pdyraga merged 31 commits from master-with-bson into master 2018-06-05 19:08:37 -04:00
Showing only changes of commit 92c3842e5f - Show all commits
+2 -1
View File
@@ -171,12 +171,13 @@ func (this *ThresholdKeyGenerator) generateHidingPolynomial() error {
return nil return nil
} }
// The secred share of the i'th authority is `f(i)`, where `f` is // The secred share of the i'th authority is `f(i) mod nm`, where `f` is
// the polynomial we generated in `GenerateHidingPolynomial` function. // the polynomial we generated in `GenerateHidingPolynomial` function.
func (this *ThresholdKeyGenerator) computeShare(index int) *big.Int { func (this *ThresholdKeyGenerator) computeShare(index int) *big.Int {
share := big.NewInt(0) share := big.NewInt(0)
for i := 0; i < this.Threshold; i++ { for i := 0; i < this.Threshold; i++ {
a := this.polynomialCoefficients[i] a := this.polynomialCoefficients[i]
// we index authorities from 1, that's why we do index+1 here
b := new(big.Int).Exp(big.NewInt(int64(index+1)), big.NewInt(int64(i)), nil) b := new(big.Int).Exp(big.NewInt(int64(index+1)), big.NewInt(int64(i)), nil)
tmp := new(big.Int).Mul(a, b) tmp := new(big.Int).Mul(a, b)
share = new(big.Int).Add(share, tmp) share = new(big.Int).Add(share, tmp)