Skip to content

Instantly share code, notes, and snippets.

@mimoo mimoo/testKeys.go
Created Nov 6, 2017

Embed
What would you like to do?
package main
import(
"fmt"
"encoding/hex"
"golang.org/x/crypto/curve25519"
)
func main(){
// decode given private key
privkey, _ := hex.DecodeString("803fcdab44e9958d2f8e4d47b5f0d481d6ddb79dd462a18ee65cabe94a9e455c")
var privkeyArray [32]byte
copy(privkeyArray[:], privkey)
// decode expected public key
expectedPubKey, _ := hex.DecodeString("26100e941bdd2103038d8dec9a1884694736f591ee814e66ae6e2e2284757136")
// create public key out of given private key
var pubkey [32]byte
curve25519.ScalarBaseMult(&pubkey, &privkeyArray)
// print
fmt.Println("calculated public key:", hex.EncodeToString(pubkey[:]))
fmt.Println(" given public key:", hex.EncodeToString(expectedPubKey))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.