Class Hash
- Namespace
- Concordium.Sdk.Types
- Assembly
- Concordium.Sdk.dll
Represents a 32-byte hash.
public abstract record Hash : IEquatable<Hash>
- Inheritance
-
Hash
- Implements
- Derived
- Inherited Members
Constructors
Hash(byte[])
Initializes a new instance of the Hash class.
protected Hash(byte[] hashAsBytes)
Parameters
hashAsBytes
byte[]A hash represented as a length-32 byte array.
Exceptions
- ArgumentException
The supplied array is not a length-32 byte array.
Hash(string)
Initializes a new instance of the Hash class.
protected Hash(string hashAsBase16String)
Parameters
hashAsBase16String
stringA hash represented as a length-64 hex encoded string.
Exceptions
- ArgumentException
The supplied string is not a 64-character hex encoded string.
Fields
BytesLength
Number of bytes used to represent the hash.
public const int BytesLength = 32
Field Value
Methods
AsSpan()
Returns read only span of underlying data.
public ReadOnlySpan<byte> AsSpan()
Returns
Equals(Hash?)
Indicates that two hashes are the same hash.
public virtual bool Equals(Hash? other)
Parameters
other
Hash
Returns
GetHashCode()
Get the hash code for a hash.
public override int GetHashCode()
Returns
ToBytes()
Copies the hash to a length-32 byte array.
public byte[] ToBytes()
Returns
- byte[]
ToString()
Get the hash as a length-64 hex encoded string.
public override sealed string ToString()