message

package
v1.6.7 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 10 Imported by: 4

Documentation

Overview

Package message is used to create network messages for the purpose of confirming integrity and proof of work.

The main purpose of the message is the possibility of retransmission with verification by the network key.

MESSAGE FORMAT

P(HM) || HM || M
where
	HM = H(M)
	where
		P - proof of work
		H - hmac (auth-key)
		M - message bytes

Index

Constants

View Source
const (
	CMessageHeadSize = 2*cSaltSize +
		symmetric.CAESBlockSize +
		hashing.CSHA256Size +
		3*encoding.CSizeUint64
)

Variables

View Source
var (
	ErrUnknownType        = errors.New("unknown type")
	ErrInvalidHeaderSize  = errors.New("length of message bytes < size of header")
	ErrInvalidProofOfWork = errors.New("got invalid proof of work")
	ErrInvalidPayloadSize = errors.New("got invalid payload size")
	ErrInvalidAuthHash    = errors.New("got invalid auth hash")
	ErrDecodePayload      = errors.New("decode payload")
)

Functions

This section is empty.

Types

type IMessage

type IMessage interface {
	types.IConverter

	GetHash() []byte
	GetVoid() []byte
	GetSalt() [2][]byte
	GetProof() uint64
	GetPayload() payload.IPayload
}

func LoadMessage

func LoadMessage(pSett ISettings, pData interface{}) (IMessage, error)

func NewMessage

func NewMessage(pSett ISettings, pPld payload.IPayload, pParallel, pLimitVoidSize uint64) IMessage

type ISettings added in v1.5.21

type ISettings interface {
	GetWorkSizeBits() uint64
	GetNetworkKey() string
}

func NewSettings added in v1.5.21

func NewSettings(pSett *SSettings) ISettings

type SSettings added in v1.5.21

type SSettings sSettings

Jump to

Keyboard shortcuts

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