Show / Hide Table of Contents

Class Hashcash

This contains a set of functions that implements Hashcash, a proof-of-work system.

Inheritance
Object
Hashcash
Namespace: Libplanet
Assembly: Libplanet.dll
Syntax
public static class Hashcash : object

Methods

| Improve this Doc View Source

Answer(Hashcash.Stamp, Int64, CancellationToken)

Finds a Nonce that satisfies the given difficulty. This process is so-called “mining”.

Declaration
public static Nonce Answer(Hashcash.Stamp stamp, long difficulty, CancellationToken cancellationToken = null)
Parameters
Type Name Description
Hashcash.Stamp stamp

A callback to get a “stamp” which is a array determined from a given Nonce value.

Int64 difficulty

A number to calculate the target number for which the returned answer should be less than.

CancellationToken cancellationToken

A cancellation token used to propagate notification that this operation should be canceled.

Returns
Type Description
Nonce

A Nonce value which satisfies the given difficulty.

See Also
Hashcash.Stamp
| Improve this Doc View Source

Hash(Byte[])

Calculates a SHA-256 digest from the given bytes.

Declaration
public static HashDigest<SHA256> Hash(byte[] bytes)
Parameters
Type Name Description
Byte[] bytes

A array to calculate its hash digest.

Returns
Type Description
HashDigest<SHA256>

A deterministic digest of the given bytes.

  • Improve this Doc
  • View Source
Back to top Copyright © 2019–2020 Planetarium