Struct HashDigest<T>
A value type to represent digest bytes determined by a
T
of
Implements
Namespace: Libplanet
Assembly: Libplanet.dll
Syntax
public struct HashDigest<T> : IEquatable<HashDigest<T>> where T : HashAlgorithm
Type Parameters
Name | Description |
---|---|
T | A |
Constructors
| Improve this Doc View SourceHashDigest(Byte[])
Converts a
Declaration
public HashDigest(byte[] hashDigest)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | hashDigest | A |
Fields
| Improve this Doc View SourceSize
The fixed, and valid
This varies depending upon what T
. For example, if T
is 20
,
and if 32
.
Declaration
public static readonly int Size
Field Value
Type | Description |
---|---|
Int32 |
Properties
| Improve this Doc View SourceByteArray
A bare immutable
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
Methods
| Improve this Doc View SourceEquals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
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
| Improve this Doc View SourceGetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
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 |
|
ToByteArray()
Gets a bare mutable
Declaration
public byte[] ToByteArray()
Returns
Type | Description |
---|---|
Byte[] | A new mutable |
See Also
| Improve this Doc View SourceToString()
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. |