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

> Gera 32 raw bytes aleatorios com random byte generator e os retorna Base64-encoded como uma string Lua.

<div className="real-function-page">
  ```lua theme={null}
  crypt.generatekey(): string
  ```

  ## Retornos

  <ResponseField name={"key"} type={"string"}>
    Base64 encoding dos 32 raw bytes gerados. A string retornada nao tem 32 caracteres.
  </ResponseField>

  ## Exemplo

  Gere uma Base64 key e decodifique-a para inspecionar a contagem de raw bytes.

  ```lua theme={null}
  local key = crypt.generatekey()
  local raw = base64_decode(key)

  local ciphertext, iv = crypt.encrypt("hello world", key)

  print(key)
  print(#raw)
  print(ciphertext, iv)
  ```
</div>
