ceremonyclient/bedlam/apps/garbled/examples/ecdh/keygen.qcl
Cassandra Heart e51992f3e8
OT
2025-03-23 21:11:16 -05:00

37 lines
734 B
Go

// -*- go -*-
package main
import (
"crypto/curve25519"
)
func main(g, e [32]byte) ([]byte, []byte, []byte) {
// var s [32]byte
// curve25519.ScalarMult(&s, &g, &e)
// return g, e, s
var privateKey [32]byte
for i := 0; i < len(privateKey); i++ {
//privateKey[i] = g[i] ^ e[i]
privateKey[i] = (i % 8) + 1
}
var publicKey [32]byte
curve25519.ScalarBaseMult(&publicKey, &privateKey)
var privateKey2 [32]byte
for i := 0; i < len(privateKey2); i++ {
//privateKey[i] = g[i] ^ e[i]
privateKey2[i] = (i % 16) + 1
}
var publicKey2 [32]byte
curve25519.ScalarBaseMult(&publicKey2, &privateKey2)
var secret [32]byte
curve25519.ScalarMult(&secret, &privateKey, &publicKey2)
return publicKey, publicKey2, secret
}