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