Documentation ¶
Index ¶
- Variables
- func CreateAddress() (*ecdsa.PrivateKey, *ecdsa.PublicKey, string)
- func CreateSignature(msg []byte, priv *ecdsa.PrivateKey) ecdsaSignature
- func DecodePrivateKey(str string) *ecdsa.PrivateKey
- func DecodePublicKey(b58 string) *ecdsa.PublicKey
- func EncodePrivateKey(privKey *ecdsa.PrivateKey) string
- func EncodePublicKey(pubKey *ecdsa.PublicKey) string
- func HexToPrivateKey(hexStr string) *ecdsa.PrivateKey
- func HexToPublicKey(xHex string, yHex string) *ecdsa.PublicKey
- func MergeTwoByteSlices(slice1 []byte, slice2 []byte) []byte
Constants ¶
This section is empty.
Variables ¶
var Curve = elliptic.P256()
Functions ¶
func CreateAddress ¶
func CreateAddress() (*ecdsa.PrivateKey, *ecdsa.PublicKey, string)
createAddress creates a new private and public key, and encodes the public key as string together these form an address for the coin
func CreateSignature ¶
func CreateSignature(msg []byte, priv *ecdsa.PrivateKey) ecdsaSignature
createSignature hashes the given bytes and signs the resulting hash with the given private key to produce signature
func DecodePrivateKey ¶
func DecodePrivateKey(str string) *ecdsa.PrivateKey
decodePrivateKey decodes the private key from given base58 encoded string
func DecodePublicKey ¶
decodePublicKey takes as parameter a base58 encoded public key string, decodes it into golang structure
func EncodePrivateKey ¶
func EncodePrivateKey(privKey *ecdsa.PrivateKey) string
encodePrivateKey base58 encodes the private key for storage/presentation
func EncodePublicKey ¶
encodePublicKey takes the ecdsa public key, encodes its two big integer parts, and merges them to a single base58 encoded string
func HexToPrivateKey ¶
func HexToPrivateKey(hexStr string) *ecdsa.PrivateKey
hexToPrivateKey converts a hex-encoded string into a golang private key structure
func HexToPublicKey ¶
HexToPublicKey converts a hex-encoded string into a golang public key structure
func MergeTwoByteSlices ¶
mergeTwoByteSlices merges two byte slices into a single slice. the new slice will start with single byte for the length of first slice in new slice. this is followed by the first slice, which is followed by second slice so newslice = [slice1length][slice1][slice2]
Types ¶
This section is empty.