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

> Генерирует 32 случайных raw bytes через random byte generator и возвращает их Base64-encoded как Lua string.

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

  ## Возвраты

  <ResponseField name={"key"} type={"string"}>
    Base64 encoding сгенерированных 32 raw bytes. Возвращенная string не имеет длину 32 символа.
  </ResponseField>

  ## Пример

  Сгенерируйте Base64 key и декодируйте его, чтобы проверить число 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>
