Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Stamp ¶
type Stamp struct {
Version int `json:"version"`
ZerosCount int `json:"zerosCount"`
Date int64 `json:"date"`
Resource string `json:"resource"`
Rand string `json:"rand"`
Counter int `json:"counter"`
}
Stamp - represents hashcash stamp
func HashToStamp ¶
HashToStamp converts hashstring to stamp
func (Stamp) ComputeHashcash ¶
ComputeHashcash - calculates correct hashcash by bruteforce until the resulting hash satisfies the condition of IsHashCorrect maxIterations to prevent endless computing (0 or -1 to disable it)
func (*Stamp) IsHashSolved ¶
IsHashCorrect - checks that hash has leading <zerosCount> zeros
func (*Stamp) ValidStamp ¶
func (p *Stamp) ValidStamp(ctx context.Context, stampForValidation Stamp, repo repository.Repository) bool
ValidStamp - checks if the stamp is valid
Click to show internal directories.
Click to hide internal directories.