gopow

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pow

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

Pow ...

func New

func New(config *PowConfig) *Pow

New helper function to return new pow object with defaults

func (*Pow) GenerateNonce

func (p *Pow) GenerateNonce() ([2]string, error)

GenerateNonce generates a new nonce, also generates signature if verify enabled

func (*Pow) VerifyDifficulty

func (p *Pow) VerifyDifficulty(hash string) bool

VerifyDifficulty verifies hash fulfils difficulty requirement

func (*Pow) VerifyHash

func (p *Pow) VerifyHash(nonce string, data string, hash string, nonceSig string) (bool, error)

VerifyHash verifies the hash given the nonce and data

func (*Pow) VerifyHashAtDifficulty

func (p *Pow) VerifyHashAtDifficulty(nonce string, data string, hash string, nonceSig string) (bool, error)

VerifyHashAtDifficulty verifies hash and difficulty

type PowConfig

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

PowConfig config struct for a new proof-of-work object

Jump to

Keyboard shortcuts

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