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) +*/ +}