Created
March 12, 2023 00:03
-
-
Save ulerdogan/687fa9679dae0fbf0f618082c60536c3 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/ecdsa" | |
"crypto/elliptic" | |
"fmt" | |
"github.com/ethereum/go-ethereum/common" | |
"github.com/ethereum/go-ethereum/crypto" | |
) | |
func main() { | |
// Ethereum adresini byte formatında belirleyin | |
addressBytes := common.Hex2Bytes("0123456789abcdef0123456789abcdef0123456") | |
// Adresi ECDSA public key'e dönüştürmek için önce byte dizisini 32 byte'a tamamlayın | |
paddedAddress := common.LeftPadBytes(addressBytes, 32) | |
// Elliptic eğri türünü belirleyin | |
curve := elliptic.P256() | |
// ECDSA public key'i elde edin | |
x, y := curve.ScalarBaseMult(paddedAddress) | |
publicKey := ecdsa.PublicKey{Curve: curve, X: x, Y: y} | |
// ECDSA public key'ini hex formatına dönüştürün ve yazdırın | |
publicKeyBytes := crypto.FromECDSAPub(&publicKey) | |
fmt.Printf("ECDSA public key: %x\n", publicKeyBytes) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment