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

> Base64 ciphertext를 Base64로 디코드된 key와 필수 Base64 IV로 AES CBC 또는 ECB를 사용해 복호화합니다.

<div className="real-function-page">
  ```lua theme={null}
  crypt.decrypt(data: string, key: string, iv: string, mode?: "CBC" | "ECB" | "AES-CBC" | "AES-ECB"): string
  ```

  ## 인수

  <ParamField path={"data"} type={"string"} required>
    복호화 전에 디코드되는 Base64 ciphertext입니다.
  </ParamField>

  <ParamField path={"key"} type={"string"} required>
    AES에 전달되기 전에 디코드되는 Base64 key입니다.
  </ParamField>

  <ParamField path={"iv"} type={"string"} required>
    mode 처리 전에 디코드되는 Base64 IV입니다. 이 인수는 ECB에서도 필수입니다.
  </ParamField>

  <ParamField path={"mode"} type={"\"CBC\" | \"ECB\" | \"AES-CBC\" | \"AES-ECB\""}>
    AES mode입니다. AES- prefix가 있으면 제거됩니다. 기본값은 AES-CBC입니다.
  </ParamField>

  ## 반환값

  <ResponseField name={"plaintext"} type={"string"}>
    Lua string으로 반환되는 plaintext 바이트입니다.
  </ResponseField>

  ## 예제

  crypt.encrypt가 반환한 ciphertext를 반환된 IV로 복호화합니다.

  ```lua theme={null}
  local key = crypt.generatekey()
  local ciphertext, iv = crypt.encrypt("hello world", key)

  local plaintext = crypt.decrypt(ciphertext, key, iv)

  print(plaintext)
  ```
</div>
