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

# crypt.hash

> Hashes Lua string bytes with a supported crypto library hash algorithm and returns a lowercase hexadecimal digest.

Hashes Lua string bytes with a supported crypto library hash algorithm and returns a lowercase hexadecimal digest.

## Syntax

```lua theme={null}
crypt.hash(data: string, algorithm?: "sha256" | "sha1" | "sha224" | "sha384" | "sha512" | "md5" | "sha3-224" | "sha3-256" | "sha3-384" | "sha3-512"): string
```

## Arguments

| Name        | Type                                                                                                                      | Required | Description                                             |
| ----------- | ------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------- |
| `data`      | `string`                                                                                                                  | Yes      | Lua string bytes passed to crypto library HashFilter.   |
| `algorithm` | `"sha256" \| "sha1" \| "sha224" \| "sha384" \| "sha512" \| "md5" \| "sha3-224" \| "sha3-256" \| "sha3-384" \| "sha3-512"` | No       | Case-sensitive hash algorithm name. Defaults to sha256. |

## Returns

| Name     | Type     | Description                                                |
| -------- | -------- | ---------------------------------------------------------- |
| `digest` | `string` | Lowercase hexadecimal digest with no prefix or separators. |

## Example

Hash Lua string bytes with the default algorithm or an explicit supported name.

```lua theme={null}
local defaultDigest = crypt.hash("hello world")
local sha3Digest = crypt.hash("hello world", "sha3-256")

print(defaultDigest)
print(sha3Digest)
```
