> ## 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 بايت خام عشوائي باستخدام random byte generator ويعيدها Base64-encoded كسلسلة Lua.

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

  ## القيم الراجعة

  <ResponseField name={"key"} type={"string"}>
    Base64 encoding للـ 32 بايت خام التي تم إنشاؤها. السلسلة المعادة ليست بطول 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>
