Returns a stable hash of a Luau function’s bytecode, as a lowercase hex string. Two functions compiled from the same source produce the same hash, which makes it useful for identifying a known function across sessions or servers.

Parameters

function
required
A Luau closure. C closures have no bytecode and are rejected.

Returns

string
A lowercase hex SHA-384 digest of the function’s bytecode.

Behavior

The hash is computed over the function’s proto bytecode, so it depends on the compiled code rather than on the closure object. It is the exact value filtergc’s Hash option matches against, so you can locate a function by hashing a known copy and filtering for it. The digest is SHA-384. Treat the string as opaque and compare it for equality rather than assuming a particular length, or that it lines up with another tool’s hash of the same function.

Example

Errors