Use faster DRBG
This commit is contained in:
parent
2761895f46
commit
3369703ace
@ -2,14 +2,16 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/henrydcase/nobs/dh/csidh"
|
||||
"github.com/henrydcase/nobs/drbg"
|
||||
"github.com/henrydcase/sidh_torture/csidh/ref/go-wrapper"
|
||||
)
|
||||
|
||||
var rng *drbg.CtrDrbg
|
||||
|
||||
func TestSS() {
|
||||
var r wrapper.Ref
|
||||
var ssRef [csidh.SharedSecretSize]byte
|
||||
@ -21,7 +23,7 @@ func TestSS() {
|
||||
prB := csidh.NewPrivateKey()
|
||||
pkB := csidh.NewPublicKey()
|
||||
|
||||
prB.Generate(rand.Reader)
|
||||
prB.Generate(rng)
|
||||
pkB.Generate(&prB)
|
||||
|
||||
s1 := time.Now()
|
||||
@ -51,9 +53,9 @@ func TestKeyGeneration() {
|
||||
prB := csidh.NewPrivateKey()
|
||||
pkB := csidh.NewPublicKey()
|
||||
|
||||
prA.Generate(rand.Reader)
|
||||
prA.Generate(rng)
|
||||
pkA.Generate(&prA)
|
||||
prB.Generate(rand.Reader)
|
||||
prB.Generate(rng)
|
||||
pkB.Generate(&prB)
|
||||
|
||||
s1 := time.Now()
|
||||
@ -76,8 +78,7 @@ func main() {
|
||||
fmt.Printf("| TestName |Go | C |\n")
|
||||
fmt.Printf("|------------------|----------|----------|\n")
|
||||
|
||||
// OZAPTF: make configurable
|
||||
// for i:=0; i<100; i++ {
|
||||
rng = drbg.NewCtrDrbg()
|
||||
for {
|
||||
TestSS()
|
||||
TestKeyGeneration()
|
||||
|
Loading…
Reference in New Issue
Block a user