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

> random byte generator로 32개의 임의 raw bytes를 생성하고 Base64-encoded Lua string으로 반환합니다.

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

  ## 반환값

  <ResponseField name={"key"} type={"string"}>
    생성된 32 raw bytes의 Base64 encoding입니다. 반환된 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>
