Removed deprecated GenerateSafePrimes function

The new function should be now called directly.
This commit is contained in:
Piotr Dyraga committed 2018-07-27 17:42:05 +02:00
1 parent 78ea6668f8
commit ca756b481b
5 files changed
+7 -56

No files matched your search

+3 -33
View File
@@ -1,8 +1,8 @@
package paillier
import (
"crypto/rand"
"errors"
"math/big"
"reflect"
"testing"
"time"
@@ -44,6 +44,7 @@ func TestAsyncGenerator(t *testing.T) {
test.bitLen,
concurrencyLevel,
test.timeout,
rand.Reader,
)
if test.expectedError != nil {
@@ -59,38 +60,7 @@ func TestAsyncGenerator(t *testing.T) {
t.Fatal(err)
}
if !p.ProbablyPrime(20) {
t.Errorf("p is not prime; p = %v", p)
}
if !q.ProbablyPrime(20) {
t.Errorf("q is not prime; q = %v", q)
}
// p = 2q + 1 ?
expectedP := new(big.Int)
expectedP.Mul(big.NewInt(2), q)
expectedP.Add(expectedP, big.NewInt(1))
if expectedP.Cmp(p) != 0 {
t.Errorf("2q + 1 != p")
}
if p.BitLen() != test.bitLen {
t.Fatalf(
"Unexpected p bit length\nActual: %v\nExpected: %v",
p.BitLen(),
test.bitLen,
)
}
if q.BitLen() != test.bitLen-1 {
t.Fatalf(
"Unexpected q bit length\nActual: %v\nExpected: %v",
q.BitLen(),
test.bitLen-1,
)
}
AreSafePrimes(p, q, test.bitLen, t)
}
})
}