# 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.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule
* **Implements:** [IEquatable\<Hash128>](https://learn.microsoft.com/dotnet/api/system.iequatable-1), [IComparable\<Hash128>](https://learn.microsoft.com/dotnet/api/system.icomparable-1)

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

## Fields

| Value                                                                    | Description                                                           |
| ------------------------------------------------------------------------ | --------------------------------------------------------------------- |
| [Value](/engine/7000.0/script-reference/unity/entities/hash128/value.md) | The 128-bit hash value, as four consecutive 32-bit unsigned integers. |

## Constructors

| Constructor                                                                                                                                                       | Description                                                                                                                          |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| [Hash128(System.String)](/engine/7000.0/script-reference/unity/entities/hash128/ctor.md#hash128\(string\))                                                        | Construct a hash from a 32 character hex string                                                                                      |
| [Hash128(System.String,System.Boolean)](/engine/7000.0/script-reference/unity/entities/hash128/ctor.md#hash128\(string-bool\))                                    | 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)](/engine/7000.0/script-reference/unity/entities/hash128/ctor.md#hash128\(uint-uint-uint-uint\)) | Construct a hash from four 32-bit input values.                                                                                      |
| [Hash128(Unity.Mathematics.uint4)](/engine/7000.0/script-reference/unity/entities/hash128/ctor.md#hash128\(uint4\))                                               | Construct a hash from a 128-bit input value.                                                                                         |

## Properties

| Property                                                                     | Description                                                           |
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| [IsValid](/engine/7000.0/script-reference/unity/entities/hash128/isvalid.md) | A Hash128 is valid, only if at least one of its 128 bits has value 1. |

## Methods

| Method                                                                               | Description                                                                                                                                                                 |
| ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [CompareTo](/engine/7000.0/script-reference/unity/entities/hash128/compareto.md)     | Compares 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. |
| [Equals](/engine/7000.0/script-reference/unity/entities/hash128/equals.md)           | Determines whether some object is equal to this hash.                                                                                                                       |
| [GetHashCode](/engine/7000.0/script-reference/unity/entities/hash128/gethashcode.md) | Computes a hashcode to support hash-based collections.                                                                                                                      |
| [ToString](/engine/7000.0/script-reference/unity/entities/hash128/tostring.md)       | Convert a Hash128 to a 32-character UTF-16 string of hexadecimal symbols.                                                                                                   |

## Operators

| Operator                                                                               | Description                                                              |
| -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| [operator ==](/engine/7000.0/script-reference/unity/entities/hash128/op-equality.md)   | Compares two hashes for equality.                                        |
| [operator >](/engine/7000.0/script-reference/unity/entities/hash128/op-greaterthan.md) | Determines whether one hash's value is greater than another hash's value |
| [operator !=](/engine/7000.0/script-reference/unity/entities/hash128/op-inequality.md) | Compares two hashes for inequality.                                      |
| [operator \<](/engine/7000.0/script-reference/unity/entities/hash128/op-lessthan.md)   | Determines whether one hash's value is less than another hash's value    |
