cryptography

package
v0.0.0-...-63dd8f1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrivKeyLen = 64
	PubKeyLen  = 32
	SeedLen    = 32
	AddressLen = 20
	SigLen     = 64
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

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

func (Address) Bytes

func (a Address) Bytes() []byte

func (Address) String

func (a Address) String() string

type PrivateKey

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

func NewPrivateKey

func NewPrivateKey() PrivateKey

func NewPrivateKeyFromBytes

func NewPrivateKeyFromBytes(b []byte) PrivateKey

func NewPrivateKeyFromSeed

func NewPrivateKeyFromSeed(seed []byte) PrivateKey

func NewPrivateKeyFromString

func NewPrivateKeyFromString(str string) PrivateKey

NewPrivateKeyFromString creates a new PrivateKey from a hexadecimal string representation of the private key seed.

The input string must be exactly 64 hexadecimal characters (32 bytes) long, representing the 32-byte private key seed. If the input string is not valid hex or the length is incorrect, the function will log a fatal error.

This function is useful for deserializing a private key from a string representation, such as when reading from a configuration file or other storage.

func (PrivateKey) Bytes

func (p PrivateKey) Bytes() []byte

func (PrivateKey) Public

func (p PrivateKey) Public() PublicKey

func (PrivateKey) Sign

func (p PrivateKey) Sign(msg []byte) Signature

type PublicKey

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

func NewPublicKeyFromBytes

func NewPublicKeyFromBytes(b []byte) PublicKey

func (PublicKey) Address

func (p PublicKey) Address() Address

func (PublicKey) Bytes

func (p PublicKey) Bytes() []byte

func (PublicKey) String

func (p PublicKey) String() string

type Signature

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

func NewSignatureFromBytes

func NewSignatureFromBytes(b []byte) Signature

func (Signature) Bytes

func (s Signature) Bytes() []byte

func (Signature) Verify

func (s Signature) Verify(pubKey PublicKey, msg []byte) bool

type TxHash

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

func NewTxHash

func NewTxHash(hash []byte) *TxHash

func (TxHash) CalculateHash

func (h TxHash) CalculateHash() ([]byte, error)

func (TxHash) Equals

func (h TxHash) Equals(other merkletree.Content) (bool, error)

Jump to

Keyboard shortcuts

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