> ## Documentation Index
> Fetch the complete documentation index at: https://docsuncv2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# getfunctionhash

Returns a deterministic hash of a Luau function's compiled body as a hexadecimal string.

```luau theme={null}
getfunctionhash(func: function): string
```

The hash covers the function's compiled bytecode instructions together with its constants. Two functions that compile to the same body with the same constants produce the same hash; changing a single constant changes it.

Most commonly used to fingerprint a function so a later hash mismatch reveals it was hooked or replaced, or to confirm a `clonefunction` copy still matches the function it was cloned from.

## Parameters

| Parameter | Type       | Description                |
| --------- | ---------- | -------------------------- |
| `func`    | `function` | The Luau function to hash. |

## Returns

`string` - a 96-character hexadecimal string (SHA-384 over the bytecode and constants). The same function hashes to the same string on every call, and the value stays stable across sessions while the function's code is unchanged.

## Example

In an RPG Roblox game, fingerprint a Luau function you located and re-check it later, so you notice if the game swapped it out from under your hook.

<CodeGroup>
  ```luau Example 1 theme={null}
  <<<<<<< HEAD
  local hash = getfunctionhash(print)
  =======
  -- getfunctionhash(func: function): string
  >>>>>>> 50e30f53759b0538759af25c9b271514aa2c9290
  ```

  ```luau Example 2 theme={null}
  local target = filtergc("function", {Name = "PurchaseFruit"}, true)
  local baseline = getfunctionhash(target)

  task.delay(30, function()
      if getfunctionhash(target) ~= baseline then
          warn("PurchaseFruit was replaced - re-apply your hook")
      end
  end)
  ```
</CodeGroup>

<Tip>
  Comparing function hashes is a fast way to verify function integrity.
</Tip>
