Documentation ¶
Index ¶
- type HashFunction
- type NonceGenerator
- type Pow
- func (p *Pow) GenerateNonce() ([2]string, error)
- func (p *Pow) VerifyDifficulty(hash string) bool
- func (p *Pow) VerifyHash(nonce string, data string, hash string, nonceSig string) (bool, error)
- func (p *Pow) VerifyHashAtDifficulty(nonce string, data string, hash string, nonceSig string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NonceGenerator ¶ added in v1.2.1
NonceGenerator function type. takes a length parameter and returns a string.
The length parameter is optional; the returned string need not be as long as the length parameter
type Pow ¶
type Pow struct { Secret string NonceLength int Check bool Difficulty int // NonceGenerator method returns a nonce. Takes an integer parameter // which is `Pow.NonceLength`. Defaults to `gonanoid.Nanoid` NonceGenerator NonceGenerator // Hash is a method that hashes a slice of bytes and returns a new slice. // Defaults to `sha256.Sum256` Hash HashFunction }
Pow ...
func (*Pow) GenerateNonce ¶
GenerateNonce generates a new nonce, also generates signature if verify enabled
func (*Pow) VerifyDifficulty ¶
VerifyDifficulty verifies hash fulfils difficulty requirement
func (*Pow) VerifyHash ¶
VerifyHash verifies the hash given the nonce and data
Click to show internal directories.
Click to hide internal directories.