Struct SodotUtils.MessageHash
- Namespace
- SodotSDK
- Assembly
- Unity.Temp.dll
Represents a cryptographic hash with a fixed length of 32 bytes. Used for message hashing in cryptographic operations.
public struct SodotUtils.MessageHash
- Inherited Members
Constructors
MessageHash(byte[])
Initializes a new MessageHash with the provided hash data.
public MessageHash(byte[] data)
Parameters
databyte[]The hash data as a byte array. Must be exactly 32 bytes long.
Exceptions
- SodotException
Thrown when data is null or not exactly 32 bytes long.
Fields
HashLength
The fixed length of hash data in bytes (32 bytes / 256 bits).
public const int HashLength = 32
Field Value
Properties
Data
Gets the hash data as a byte array.
public readonly byte[] Data { get; }
Property Value
- byte[]
Methods
FromKeccak256(byte[])
Creates a MessageHash by computing the Keccak-256 hash of the input data. Uses native implementation through P/Invoke for performance.
public static SodotUtils.MessageHash FromKeccak256(byte[] data)
Parameters
databyte[]The input data to hash.
Returns
- SodotUtils.MessageHash
A MessageHash containing the Keccak-256 hash of the input data.
FromSha256(byte[])
Creates a MessageHash by computing the SHA-256 hash of the input data.
public static SodotUtils.MessageHash FromSha256(byte[] data)
Parameters
databyte[]The input data to hash.
Returns
- SodotUtils.MessageHash
A MessageHash containing the SHA-256 hash of the input data.