Improved performance of the safe prime generator #9

Merged
pdyraga merged 17 commits from master into master 2018-08-02 06:47:13 -04:00
Showing only changes of commit ee7e96eaf6 - Show all commits
+6 -7
View File
@@ -2,7 +2,6 @@ package paillier
import ( import (
"errors" "errors"
"fmt"
"math/big" "math/big"
"reflect" "reflect"
"testing" "testing"
@@ -77,18 +76,18 @@ func TestAsyncGenerator(t *testing.T) {
t.Errorf("2q + 1 != p") t.Errorf("2q + 1 != p")
} }
if len(p.Bytes()) != test.bitLen { if p.BitLen() != test.bitLen {
fmt.Errorf( t.Fatalf(
"Unexpected p bit length\nActual: %v\nExpected: %v", "Unexpected p bit length\nActual: %v\nExpected: %v",
len(p.Bytes()), p.BitLen(),
test.bitLen, test.bitLen,
) )
} }
if len(q.Bytes()) != test.bitLen-1 { if q.BitLen() != test.bitLen-1 {
fmt.Errorf( t.Fatalf(
"Unexpected q bit length\nActual: %v\nExpected: %v", "Unexpected q bit length\nActual: %v\nExpected: %v",
len(q.Bytes()), q.BitLen(),
test.bitLen-1, test.bitLen-1,
) )
} }