nonces

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2020 License: LGPL-3.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorNonceTooLowInNonceSet = errors.New("nonce too low in nonce set")
	ErrorStartNonce            = errors.New("start nonce error")
	ErrorNonceOverFlow         = errors.New("nonce over flow")
)

Functions

This section is empty.

Types

type NonceBitMask

type NonceBitMask []byte

type NonceSet

type NonceSet struct {
	Start   uint64
	BitMask NonceBitMask
	Length  uint32 // num of bit
}

func NewNonceSet

func NewNonceSet(other *NonceSet) *NonceSet

func (*NonceSet) Add

func (s *NonceSet) Add(nonce uint64, maxLength uint64) (error, bool)

func (*NonceSet) DeepCopy

func (s *NonceSet) DeepCopy(other *NonceSet)

func (*NonceSet) NextNonce

func (s *NonceSet) NextNonce() uint64

func (*NonceSet) Reset

func (s *NonceSet) Reset(start uint64) (error, bool)

func (*NonceSet) ResetThenSearch

func (s *NonceSet) ResetThenSearch(needReset bool, newStart uint64, nonce uint64, maxLength uint64) (SearchResult, error, bool)

if param 'needReset' is false , will not use param 'newStart'

func (*NonceSet) Search

func (s *NonceSet) Search(nonce uint64, maxLength uint64) SearchResult

func (*NonceSet) String

func (n *NonceSet) String() string

type SearchResult

type SearchResult int8
const (
	NotAllowedTooNew       SearchResult = -1
	NotContainedAndAllowed SearchResult = 0
	Contained              SearchResult = 1
	NotAllowedTooOld       SearchResult = 2
)

Jump to

Keyboard shortcuts

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