Documentation

Unity Engine


Unity Engine


Hash128

A 128 bit hash, for cases where 32 or 64 bits are insufficient. Built on top of Unity.Mathematics types that will Burst-compile to SIMD instructions, for efficiency comparable to a 32-bit hash.
Read time 1 minuteLast updated a day ago

Definition

public struct Hash128 : IEquatable<Hash128>, IComparable<Hash128>

Fields

Value

Description

ValueThe 128-bit hash value, as four consecutive 32-bit unsigned integers.

Constructors

Constructor

Description

Hash128(System.String)Construct a hash from a 32 character hex string
Hash128(System.String,System.Boolean)Construct a hash from a 32 character hex string If the string has the incorrect length or non-hex characters the Value will be all 0
Hash128(System.UInt32,System.UInt32,System.UInt32,System.UInt32)Construct a hash from four 32-bit input values.
Hash128(Unity.Mathematics.uint4)Construct a hash from a 128-bit input value.

Properties

Property

Description

IsValidA Hash128 is valid, only if at least one of its 128 bits has value 1.

Methods

Method

Description

CompareToCompares this hash's value to another hash's, and returns an integer that is negative if this hash's value is less, 0 if the same, or positive if more than the other hash.
EqualsDetermines whether some object is equal to this hash.
GetHashCodeComputes a hashcode to support hash-based collections.
ToStringConvert a Hash128 to a 32-character UTF-16 string of hexadecimal symbols.

Operators

Operator

Description

operator ==Compares two hashes for equality.
operator >Determines whether one hash's value is greater than another hash's value
operator !=Compares two hashes for inequality.
operator <Determines whether one hash's value is less than another hash's value