From b6bb3a63d05769ca318a1d66b279d0ca7abd75d5 Mon Sep 17 00:00:00 2001 From: Kris Kwiatkowski Date: Wed, 16 Jan 2019 17:22:27 +0000 Subject: [PATCH] Adds CSIDH test file --- csidh/test/test.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 csidh/test/test.go diff --git a/csidh/test/test.go b/csidh/test/test.go new file mode 100644 index 0000000..014aa5b --- /dev/null +++ b/csidh/test/test.go @@ -0,0 +1,42 @@ +package main + +/* +#cgo CFLAGS: -I../ref/csidh +#cgo LDFLAGS: -L../build -lcsidh +#include +*/ +import "C" +import "fmt" +//import rand "crypto/rand" +import csidh "github.com/henrydcase/nobs/dh/csidh" +//import "unsafe" +//import "runtime" +import rand "crypto/rand" + +func main() { + prA := csidh.NewPrivateKey() + prA.Generate(rand.Reader) + + prB := csidh.NewPrivateKey() + prB.Generate(rand.Reader) + + for i:=0; i<7; i++ { + var b [37]byte + prA.Generate(rand.Reader) + if !prA.Export(b[:]) { + panic("Export failed") + } + fmt.Printf("%X\n", b) + } + + pkA := csidh.NewPublicKey() + pkA.Generate(&prA) + +/* + print("ONE") + pkB := csidh.NewPublicKey() + pkB.Generate(&prB) + print("ONE") + pkA.DeriveSecret(&pkB, &prA) +*/ +}