crypto

package
v0.0.0-...-bda6563 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 12 Imported by: 6

Documentation

Index

Constants

View Source
const (
	Sha3 = "sha3_24_rounds"
)

Variables

This section is empty.

Functions

func CountZeros

func CountZeros(d []byte) byte

func Decrypt

func Decrypt(data []byte, passphrase string) ([]byte, error)

func Encrypt

func Encrypt(data []byte, passphrase string) ([]byte, error)

func Hash

func Hash(key []byte) []byte

func IntToHex

func IntToHex(num uint64) []byte

func PoW

func PoW(blockHash string, txID string, difficulty uint, hashFunction string) (uint64, []byte, error)

PoW calculates proof of work given block hash, transaction hash, target difficulty and a hash function. returns the nonce, the hash and th error if any.

func RandomHash

func RandomHash() string

func Verify

func Verify(blockHash string, tid string, nonce uint64, hashFuncion string, difficulty uint) (bool, byte)

Verify checks that the hash with the given nonce results in the target difficulty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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