• Overview
  • Design
  • API Reference
  • Changelog
  • Contribute
Show / Hide Table of Contents
  • Libplanet
    • Address
    • AddressExtension
    • ByteUtil
    • Hashcash
    • Hashcash.Stamp
    • HashDigest<T>
    • HashDigestExtension
    • Nonce
  • Libplanet.Action
    • AccountStateGetter
    • ActionEvaluation
    • ActionTypeAttribute
    • IAccountStateDelta
    • IAction
    • IActionContext
    • IRandom
    • MissingActionTypeException
    • PolymorphicAction<T>
    • RandomExtension
    • UnexpectedlyTerminatedActionException
  • Libplanet.Blockchain
    • BlockChain<T>
    • BlockChain<T>.TipChangedEventArgs
    • IncompleteBlockStatesException
    • MineBlockEventArgs<T>
  • Libplanet.Blockchain.Policies
    • BlockPolicy<T>
    • IBlockPolicy<T>
  • Libplanet.Blocks
    • Block<T>
    • InvalidBlockDifficultyException
    • InvalidBlockException
    • InvalidBlockHashException
    • InvalidBlockIndexException
    • InvalidBlockNonceException
    • InvalidBlockPreviousHashException
    • InvalidBlockTimestampException
    • InvalidGenesisBlockException
  • Libplanet.Crypto
    • CryptoConfig
    • DefaultCryptoBackend
    • ICryptoBackend
    • InvalidCiphertextException
    • PrivateKey
    • PublicKey
    • SymmetricKey
  • Libplanet.KeyStore
    • IncorrectPassphraseException
    • InvalidKeyJsonException
    • KeyJsonException
    • MismatchedAddressException
    • ProtectedPrivateKey
    • UnsupportedKeyJsonException
  • Libplanet.KeyStore.Ciphers
    • Aes128Ctr
    • ICipher
  • Libplanet.KeyStore.Kdfs
    • IKdf
    • Pbkdf2<T>
    • Scrypt
  • Libplanet.Net
    • ActionExecutionState
    • BlockDownloadState
    • BoundPeer
    • DifferentAppProtocolVersionException
    • DifferentProtocolVersionEventArgs
    • IceServer
    • IceServerException
    • InvalidMessageException
    • NoSwarmContextException
    • Peer
    • PeerNotFoundException
    • PeerState
    • PreloadBlockDownloadFailEventArgs
    • PreloadState
    • StateDownloadState
    • Swarm<T>
    • SwarmException
  • Libplanet.Net.Protocols
    • PeerDiscoveryException
  • Libplanet.Serialization
    • SerializationInfoExtension
  • Libplanet.Store
    • BaseIndex<TKey, TVal>
    • BaseStore
    • BlockSet<T>
    • ChainIdNotFoundException
    • DefaultStore
    • IStore
    • StoreExtension
    • TransactionSet<T>
  • Libplanet.Tx
    • InvalidTxException
    • InvalidTxIdException
    • InvalidTxNonceException
    • InvalidTxPublicKeyException
    • InvalidTxSignatureException
    • InvalidTxUpdatedAddressesException
    • Transaction<T>
    • TxId

Struct HashDigest<T>

A value type to represent digest bytes determined by a . For more type safety, it takes a type parameter T of .

Implements
IEquatable<HashDigest<T>>
Namespace: Libplanet
Assembly: Libplanet.dll
Syntax
public struct HashDigest<T> : IEquatable<HashDigest<T>> where T : HashAlgorithm
Type Parameters
Name Description
T

A which corresponds to a digest. This determines Size of a digest.

Constructors

| Improve this Doc View Source

HashDigest(Byte[])

Converts a array into a HashDigest<T>.

Declaration
public HashDigest(byte[] hashDigest)
Parameters
Type Name Description
Byte[] hashDigest

A array that encodes a HashDigest<T>. It must not be null, and its must be the same to Size.

Fields

| Improve this Doc View Source

Size

The fixed, and valid of a array of every digest.

This varies depending upon what is used for T. For example, if T is Size is 20, and if it is 32.

Declaration
public static readonly int Size
Field Value
Type Description
Int32

Properties

| Improve this Doc View Source

ByteArray

A bare immutable array of the digest.

Declaration
public ImmutableArray<byte> ByteArray { get; }
Property Value
Type Description
ImmutableArray<Byte>
Remarks

It is immutable. For a mutable array, use ToByteArray() method instead.

See Also
ToByteArray()

Methods

| Improve this Doc View Source

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
Object obj
Returns
Type Description
Boolean
| Improve this Doc View Source

FromString(String)

Converts a given hexadecimal representation of a digest into a HashDigest<T> object.

This is an inverse function of ToString() method.

Declaration
public static HashDigest<T> FromString(string hexDigest)
Parameters
Type Name Description
String hexDigest

A hexadecimal representation of a HashDigest<T>.

Returns
Type Description
HashDigest<T>

A corresponding HashDigest<T> value.

See Also
ToString()
ToHashDigest<T>(String)
| Improve this Doc View Source

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
Int32
| Improve this Doc View Source

Satisfies(Int64)

Tests if a digest is less than the target computed for the given difficulty).

Declaration
public bool Satisfies(long difficulty)
Parameters
Type Name Description
Int64 difficulty

The difficulty to compute target number.

Returns
Type Description
Boolean

true only if a digest is less than the target computed for the given difficulty). If difficulty is 0 it always returns true.

| Improve this Doc View Source

ToByteArray()

Gets a bare mutable array of the digest.

Declaration
public byte[] ToByteArray()
Returns
Type Description
Byte[]

A new mutable array of the digest. Since a returned array is created every time the method is called, any mutations on that array does not affect to the digest object.

See Also
ByteArray
| Improve this Doc View Source

ToString()

Gets a hexadecimal representation of a digest.

This is an inverse function of FromString(String).

Declaration
public override string ToString()
Returns
Type Description
String

A hexadecimal representation of a digest.

See Also
FromString(String)

Implements

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