sidh_torture/csidh/test/test.go

43 lines
790 B
Go
Raw Normal View History

2019-01-16 17:22:27 +00:00
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)
*/
}