utils

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package utils contains functions for hashing, signing and verifying data

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToString

func BoolToString(input bool) string

BoolToString converts bool to int represented in string

func BuildSecret

func BuildSecret(privateKey *btcec.PrivateKey, walletID, coin, netShort string) (string, error)

BuildSecret derives invitation secret for multi-signature wallets

func Hash160

func Hash160(data []byte) ([]byte, error)

Hash160 performs the same operations as OP_HASH160 in Bitcoin Script It hashes the given data first with SHA256, then RIPEMD160

func HashMessage

func HashMessage(input []byte) []byte

HashMessage calculates double sha-256 and returns reverse bytes

func ParseSecret

func ParseSecret(secret string) (*btcec.PrivateKey, string, string, string, error)

ParseSecret parses shared wallet secret

func Reverse

func Reverse(data []byte) []byte

Reverse reverses byte array

func Sha256

func Sha256(data []byte) []byte

Sha256 calculates sha-256 sum

func SignMessage

func SignMessage(data []byte, privateKey *btcec.PrivateKey) ([]byte, error)

SignMessage takes message hash and generates ECDSA signature with private key

func ToBytes

func ToBytes(input string) ([]byte, error)

ToBytes converts hex-encoded string to bytes

func ToHex

func ToHex(input []byte) string

ToHex converts bytes to hex-encoded string

func VerifyMessage

func VerifyMessage(data, sig []byte, publicKey *btcec.PublicKey) (bool, error)

VerifyMessage takes message hash and verifies it's signature using public key

Types

This section is empty.

Jump to

Keyboard shortcuts

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