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

# crypt.generatekey

Generates a random 32-byte AES key and returns it encoded in base64 (44 characters).

```luau theme={null}
crypt.generatekey(): string
```

## Returns

`string` - exactly 44 characters of base64, encoding 32 raw bytes.

## Example

<CodeGroup>
  ```luau Example 1 theme={null}
  <<<<<<< HEAD
  local generatekey = crypt.generatekey()
  =======
  -- crypt.generatekey(): string
  >>>>>>> 50e30f53759b0538759af25c9b271514aa2c9290
  ```

  ```luau Example 2 theme={null}
  local key = crypt.generatekey()
  print("Key (base64): ", key)
  ```
</CodeGroup>

<Tip>
  Generates keys with high entropy to ensure cryptographic strength.
</Tip>
