Adds CSIDH test file
This commit is contained in:
parent
ff97825ea5
commit
b6bb3a63d0
42
csidh/test/test.go
Normal file
42
csidh/test/test.go
Normal 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)
|
||||
*/
|
||||
}
|
Loading…
Reference in New Issue
Block a user