crypto

package
v1.8.4 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 11 Imported by: 0

README

This code is based on btcd library, which is licenced uder the copyfree ISC license. https://github.com/btcsuite/btcd/tree/master

Documentation

Index

Constants

View Source
const RecoveryIDOffset = 64
View Source
const SignatureLength = 64 + 1

Variables

This section is empty.

Functions

func GenerateID added in v1.7.0

func GenerateID(hexEncodedPrv string) (string, error)

func RecoverPublicKey

func RecoverPublicKey(hash *Hash, sig []byte) ([]byte, error)

func RecoveredID

func RecoveredID(hash *Hash, sig []byte) (string, error)

func Sign

func Sign(hash *Hash, prv *ecdsa.PrivateKey) ([]byte, error)

func Verify

func Verify(pubkey []byte, hash *Hash, sig []byte) (bool, error)

Types

type Hash

type Hash struct {
	// contains filtered or unexported fields
}

func CreateHashFromString

func CreateHashFromString(str string) (*Hash, error)

func GenerateHash

func GenerateHash(buf []byte) *Hash

func GenerateHashFromString

func GenerateHashFromString(str string) *Hash

func (*Hash) Bytes

func (hash *Hash) Bytes() []byte

func (*Hash) String

func (hash *Hash) String() string

type Idendity

type Idendity struct {
	// contains filtered or unexported fields
}

func CreateIdendity

func CreateIdendity() (*Idendity, error)

func CreateIdendityFromString

func CreateIdendityFromString(hexEncodedPrv string) (*Idendity, error)

func (*Idendity) ID

func (idendity *Idendity) ID() string

func (*Idendity) PrivateKey

func (idendity *Idendity) PrivateKey() *ecdsa.PrivateKey

func (*Idendity) PrivateKeyAsHex

func (idendity *Idendity) PrivateKeyAsHex() string

func (*Idendity) PublicKey

func (idendity *Idendity) PublicKey() []byte

func (*Idendity) PublicKeyAsHex

func (idendity *Idendity) PublicKeyAsHex() string

Jump to

Keyboard shortcuts

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