Skip to content

Instantly share code, notes, and snippets.

@dchest
Last active October 7, 2015 12:24
Show Gist options
  • Save dchest/0ac4e5ec809c74ecf4ba to your computer and use it in GitHub Desktop.
Save dchest/0ac4e5ec809c74ecf4ba to your computer and use it in GitHub Desktop.
package main
import (
"encoding/hex"
"fmt"
"golang.org/x/crypto/curve25519"
)
func main() {
a, _ := hex.DecodeString("0300000000000000000000000000000000000000000000000000000000000000")
b, _ := hex.DecodeString("0900000000000000000000000000000000000000000000000000000000000000")
var ax, bx, dx [32]byte
copy(ax[:], a)
copy(bx[:], b)
curve25519.ScalarMult(&dx, &ax, &bx)
fmt.Printf("%x\n", dx)
}
@dchest
Copy link
Author

dchest commented Oct 7, 2015

Result:

$ go run main.go
2fe57da347cd62431528daac5fbb290730fff684afc4cfc2ed90995f58cb3b74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment