Struct HashDigest<T>
A value type to represent digest bytes determined by a
T
of
Namespace: Libplanet.Common
Assembly: Libplanet.Common.dll
Syntax
public readonly struct HashDigest<T>
where T : HashAlgorithm
Type Parameters
Name | Description |
---|---|
T | A |
Constructors
| Improve this Doc View SourceHashDigest(in ImmutableArray<Byte>)
Converts an immutable
Declaration
public HashDigest(in ImmutableArray<byte> hashDigest)
Parameters
Type | Name | Description |
---|---|---|
ImmutableArray<System.Byte> | hashDigest | An immutable |
HashDigest(IValue)
A value type to represent digest bytes determined by a
T
of
Declaration
public HashDigest(IValue bencoded)
Parameters
Type | Name | Description |
---|---|---|
IValue | bencoded |
HashDigest(Byte[])
Converts a
Declaration
public HashDigest(byte[] hashDigest)
Parameters
Type | Name | Description |
---|---|---|
System.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 |
---|---|
System.Int32 |
Properties
| Improve this Doc View SourceBencoded
A value type to represent digest bytes determined by a
T
of
Declaration
public readonly IValue Bencoded { get; }
Property Value
Type | Description |
---|---|
IValue |
ByteArray
A bare immutable
Declaration
public readonly ImmutableArray<byte> ByteArray { get; }
Property Value
Type | Description |
---|---|
ImmutableArray<System.Byte> |
Remarks
It is immutable. For a mutable array, use ToByteArray() method instead.
See Also
Methods
| Improve this Doc View SourceDeriveFrom(ImmutableArray<Byte>)
Computes a hash digest of the algorithm T
from the given
input
bytes.
Declaration
public static HashDigest<T> DeriveFrom(ImmutableArray<byte> input)
Parameters
Type | Name | Description |
---|---|---|
ImmutableArray<System.Byte> | input | The bytes to compute its hash. |
Returns
Type | Description |
---|---|
HashDigest<T> | The hash digest derived from |
DeriveFrom(ReadOnlySpan<Byte>)
Computes a hash digest of the algorithm T
from the given
input
bytes.
Declaration
public static HashDigest<T> DeriveFrom(ReadOnlySpan<byte> input)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlySpan<System.Byte> | input | The bytes to compute its hash. |
Returns
Type | Description |
---|---|
HashDigest<T> | The hash digest derived from |
DeriveFrom(Byte[])
Computes a hash digest of the algorithm T
from the given
input
bytes.
Declaration
public static HashDigest<T> DeriveFrom(byte[] input)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | input | The bytes to compute its hash. |
Returns
Type | Description |
---|---|
HashDigest<T> | The hash digest derived from |
Equals(HashDigest<T>)
A value type to represent digest bytes determined by a
T
of
Declaration
public readonly bool Equals(HashDigest<T> other)
Parameters
Type | Name | Description |
---|---|---|
HashDigest<T> | other |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Nullable<Object>)
A value type to represent digest bytes determined by a
T
of
Declaration
public override readonly bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Object> | obj |
Returns
Type | Description |
---|---|
System.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 |
---|---|---|
System.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()
A value type to represent digest bytes determined by a
T
of
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
ToByteArray()
Gets a bare mutable
Declaration
public readonly byte[] ToByteArray()
Returns
Type | Description |
---|---|
System.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 readonly string ToString()
Returns
Type | Description |
---|---|
System.String | A hexadecimal representation of a digest. |