crypto

package
v0.0.0-...-280ecc9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKeyAndAddress

func GenerateKeyAndAddress() (privKeyHex string, address string, err error)

GenerateKeyAndAddress generates a new private key and corresponding Bitcoin address using secp256k1 elliptic curve cryptography. The private key is encoded in hex and the address is in bech32 format.

func PublicKeyToAddress

func PublicKeyToAddress(publicKey ecdsa.PublicKey) (string, error)

publicKeyToAddress calculates the Bitcoin address corresponding to an ECDSA public key. The resulting address will be a bech32-encoded string in the 'bc' prefix.

The public key is first SHA256-hashed, and then the resulting hash is RIPEMD160-hashed. The resulting hash is then run through the bech32 conversion algorithm to produce the final Bitcoin address.

Refer to BIP13 for more information on the bech32 encoding format.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL