Created
November 23, 2018 13:48
-
-
Save dshulyak/b8f3e043f6876cefb051e8b0b3383a12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/elliptic" | |
"crypto/rand" | |
"fmt" | |
"github.com/ethereum/go-ethereum/common/hexutil" | |
"github.com/ethereum/go-ethereum/crypto" | |
"github.com/ethereum/go-ethereum/crypto/ecies" | |
) | |
func main() { | |
key, _ := crypto.GenerateKey() | |
r, _ := ecies.GenerateKey(rand.Reader, key.PublicKey, ecies.ParamsFromCurve(key.PublicKey.Curve)) | |
fmt.Println(hexutil.Bytes(elliptic.Marshal(r.PublicKey.Curve, r.PublicKey.X, r.PublicKey.Y)).String()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment