Adds CSIDH test file

This commit is contained in:
Henry Case 2019-01-16 17:22:27 +00:00
parent ff97825ea5
commit b6bb3a63d0

42
csidh/test/test.go Normal file
View File

@ -0,0 +1,42 @@
package main
/*
#cgo CFLAGS: -I../ref/csidh
#cgo LDFLAGS: -L../build -lcsidh
#include <csidh.h>
*/
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)
*/
}