Struct HashDigest<T>
A value type to represent digest bytes determined by a
System.T
of
System.
Inherited Members
Namespace: Libplanet.Common
Assembly: Libplanet.Common.dll
Syntax
[TypeConverter(typeof(HashDigestTypeConverter))]
[Serializable]
public readonly struct HashDigest<T> : ISerializable, IEquatable<HashDigest<T>> where T : HashAlgorithm
Type Parameters
Name | Description |
---|---|
T | A System. |
Constructors
| Improve this Doc View SourceHashDigest(in ImmutableArray<Byte>)
Converts an immutable System.
Declaration
public HashDigest(in ImmutableArray<byte> hashDigest)
Parameters
Type | Name | Description |
---|---|---|
Immutable |
hashDigest | An immutable System. |
Exceptions
Type | Condition |
---|---|
System. |
Thrown when the given
|
See Also
HashDigest(IValue)
A value type to represent digest bytes determined by a
System.T
of
System.
Declaration
public HashDigest(IValue bencoded)
Parameters
Type | Name | Description |
---|---|---|
IValue | bencoded |
See Also
HashDigest(Byte[])
Converts a System.
Declaration
public HashDigest(byte[] hashDigest)
Parameters
Type | Name | Description |
---|---|---|
System. |
hashDigest | A System. |
Exceptions
Type | Condition |
---|---|
System. |
Thrown when the given
|
System. |
Thrown when the given
|
See Also
Fields
| Improve this Doc View SourceSize
The fixed, and valid System.
This varies depending upon what System.T
. For example, if T
is System.20
,
and if System.32
.
Declaration
public static readonly int Size
Field Value
Type | Description |
---|---|
System. |
See Also
Properties
| Improve this Doc View SourceBencoded
A value type to represent digest bytes determined by a
System.T
of
System.
Declaration
public readonly IValue Bencoded { get; }
Property Value
Type | Description |
---|---|
IValue |
See Also
ByteArray
A bare immutable System.
Declaration
public readonly ImmutableArray<byte> ByteArray { get; }
Property Value
Type | Description |
---|---|
Immutable |
Remarks
It is immutable. For a mutable array, use
To
See Also
Methods
| Improve this Doc View SourceDeriveFrom(ImmutableArray<Byte>)
Computes a hash digest of the algorithm T
from the given
input
bytes.
Declaration
[Pure]
public static HashDigest<T> DeriveFrom(ImmutableArray<byte> input)
Parameters
Type | Name | Description |
---|---|---|
Immutable |
input | The bytes to compute its hash. |
Returns
Type | Description |
---|---|
Hash |
The hash digest derived from |
See Also
DeriveFrom(Byte[])
Computes a hash digest of the algorithm T
from the given
input
bytes.
Declaration
[Pure]
public static HashDigest<T> DeriveFrom(byte[] input)
Parameters
Type | Name | Description |
---|---|---|
System. |
input | The bytes to compute its hash. |
Returns
Type | Description |
---|---|
Hash |
The hash digest derived from |
See Also
DeriveFrom(ReadOnlySpan<Byte>)
Computes a hash digest of the algorithm T
from the given
input
bytes.
Declaration
[Pure]
public static HashDigest<T> DeriveFrom(ReadOnlySpan<byte> input)
Parameters
Type | Name | Description |
---|---|---|
System. |
input | The bytes to compute its hash. |
Returns
Type | Description |
---|---|
Hash |
The hash digest derived from |
See Also
Equals(HashDigest<T>)
A value type to represent digest bytes determined by a
System.T
of
System.
Declaration
[Pure]
public readonly bool Equals(HashDigest<T> other)
Parameters
Type | Name | Description |
---|---|---|
Hash |
other |
Returns
Type | Description |
---|---|
System. |
See Also
Equals(Object)
A value type to represent digest bytes determined by a
System.T
of
System.
Declaration
[Pure]
public override readonly bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System. |
obj |
Returns
Type | Description |
---|---|
System. |
Overrides
See Also
FromString(String)
Converts a given hexadecimal representation of a digest into
a Hash
This is an inverse function of To
Declaration
[Pure]
public static HashDigest<T> FromString(string hexDigest)
Parameters
Type | Name | Description |
---|---|---|
System. |
hexDigest | A hexadecimal representation of
a Hash |
Returns
Type | Description |
---|---|
Hash |
A corresponding Hash |
Exceptions
Type | Condition |
---|---|
System. |
Thrown when the given
|
System. |
Thrown when the given
|
See Also
| Improve this Doc View SourceGetHashCode()
A value type to represent digest bytes determined by a
System.T
of
System.
Declaration
[Pure]
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
System. |
Overrides
See Also
GetObjectData(SerializationInfo, StreamingContext)
A value type to represent digest bytes determined by a
System.T
of
System.
Declaration
public readonly void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System. |
info | |
System. |
context |
See Also
ToByteArray()
Gets a bare mutable System.
Declaration
[Pure]
public readonly byte[] ToByteArray()
Returns
Type | Description |
---|---|
System. |
A new mutable System. |
See Also
| Improve this Doc View SourceToString()
Gets a hexadecimal representation of a digest.
This is an inverse function of From
Declaration
[Pure]
public override readonly string ToString()
Returns
Type | Description |
---|---|
System. |
A hexadecimal representation of a digest. |