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

> Menghasilkan 32 raw bytes acak dengan random byte generator dan mengembalikannya Base64-encoded sebagai string Lua.

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

  ## Return

  <ResponseField name={"key"} type={"string"}>
    Base64 encoding dari 32 raw bytes yang dihasilkan. String yang dikembalikan bukan 32 karakter.
  </ResponseField>

  ## Contoh

  Hasilkan Base64 key dan dekode untuk memeriksa jumlah 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>
