dashmsg package - github.com/dashhive/dashmsg - Go Packages
- Variables
- func AddressToCointype(addr string) (string, error)
- func DoubleHash(buf []byte) []byte
- func EncodeToBCVarint(m int) []byte
- func GenerateWIF(magicVersion string) string
- func MagicConcat(magicBytes, msg []byte) []byte
- func MagicHash(msg []byte) []byte
- func MagicSign(priv *ecdsa.PrivateKey, msg []byte) ([]byte, error)
- func MagicVerify(addr Base58Check, msg []byte, sig Base64) error
- func MarshalPublicKey(pub ecdsa.PublicKey) []byte
- func PublicKeyToAddress(magicVersion string, pub ecdsa.PublicKey) string
- func SigToPub(magichash, dsig []byte) (*ecdsa.PublicKey, error)
- func WIFToPrivateKey(wif string) (string, *ecdsa.PrivateKey, error)
- type Base58Check
- type Base64
- type CompactSignature
This section is empty.
var ( CheckVersion = "4c" CheckVersionTest = "8c" WIFVersion = "cc" WIFVersionTest = "ef" MagicBytes = []byte("DarkCoin Signed Message:\n") )
AddressToCointype reads the magic version (coin / network type) from the base58check address
DoubleHash simply runs one sha256 sum in series with another
EncodeToBCVarint is a special variable-width byte encoding for 8, 16, 32, or 64-bit integers. For integers less than 253 bytes it uses a single bit. 253, 254, and 255 signify a 16, 32, and 64-bit (2, 4, and 8-byte) little-endian encodings respectively.
GenerateWIF creates a new wallet private key as WIF
MagicConcat combines the magic bytes (which signify the network the message belongs to) and message, with their respective lengths (encoded as BCVarint) prepended to each
MagicHash combines the magic bytes and message, with their respective lengths (encoded as BCVarint) prepended to each, and then double hashes the result
MagicSign scopes the signature of a message to the Dash network
MagicVerify checks that the given public key hash payment address can be used to verify the given base64 signature and arbitrary message
MarshalPublicKey uses elliptic.Marshal to output the secp256k1.S256() curve public key
PublicKeyToAddress transforms a PublicKey into a PubKeyHash address is Base58Check format
SigToPub computes the public key from the message's magichash and the recovery signature (has the magic byte, a.k.a. "i" at the front of it)
WIFToPrivateKey decodes the base58check (WIF) into the network magicVersion and a standard(ish) ECDSA private key
Base58Check indicates that the given string should be in Base58Check encoded (coint type prefix on double hash of public key, BaseX-style Base58 encoding)
Base64 indicates that the given string should be Base64 encoded (std, with padding)
CompactSignature is the 65-byte Dash signature with the magic "i" recovery int as the first byte
DecodeSignature will break a Dash message signature into its component parts of "i" (the pub key recovery int), and "r" and "s" - the normal (non-ASN.1) ECDSA signature parts