hashcash

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2015 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package hashcash implements the hashcash algorithm

Index

Constants

View Source
const NonceSize = 8

NonceSize is the size of a hashcash nonce

View Source
const Version = "0.0.1 very alpha"

Version of this release

Variables

View Source
var (
	// Steps is the number of steps per thread per cycle
	Steps = uint64(4194304)
	// SingleThreadBits Number of bits required for parallel computing
	SingleThreadBits = byte(20)
)

Functions

func BitCount

func BitCount(d [32]byte) byte

BitCount counts leading zero bits in d and returns them

func ComputeNonce

func ComputeNonce(d []byte, bits byte, c, stop uint64) (nonce []byte, ok bool)

ComputeNonce is the hashcash algorithm c is the start value for calculation, stop is the end value. Both can be 0 to ignore segemented calculations

func ComputeNonceParallel

func ComputeNonceParallel(d []byte, bits byte, start, stop uint64) (nonce []byte, ok bool)

ComputeNonceParallel parallel compute hashcash

func ComputeNonceSelect

func ComputeNonceSelect(d []byte, bits byte, start, stop uint64) (nonce []byte, ok bool)

ComputeNonceSelect calls parallel or single compute depending on bits

func NonceToUInt64

func NonceToUInt64(nonce []byte) uint64

NonceToUInt64 converts a nonce back to uint64

func TestNonce

func TestNonce(d, nonce []byte, bits byte) (bool, byte)

TestNonce verifies that a given nonce generates bits zero bits on d when hashed

Types

This section is empty.

Jump to

Keyboard shortcuts

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