Created
April 12, 2019 06:12
-
-
Save Jwata/ff1d194b80a4e74f8f8bf9dcd7feef94 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ( | |
| "encoding/hex" | |
| "fmt" | |
| "github.com/btcsuite/btcd/btcec" | |
| ) | |
| func privkeyToPubkey(priv int) int { | |
| pub := priv * 2 | |
| return pub | |
| } | |
| func genPrivkey(privHex string) *btcec.PrivateKey { | |
| pk, _ := hex.DecodeString(privHex) | |
| priv, _ := btcec.PrivKeyFromBytes(btcec.S256(), pk) | |
| return priv | |
| } | |
| func main() { | |
| privHex := "a2b1" | |
| priv := genPrivkey(privHex) | |
| fmt.Println(priv.D) | |
| // pub := privkeyToPubkey(priv) | |
| // fmt.Printf("priv: %d, pub: %d\n", priv, pub) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment