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

> Mendekripsi Base64 ciphertext dengan key yang didekode dari Base64 dan Base64 IV wajib memakai AES CBC atau 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
  ```

  ## Argumen

  <ParamField path={"data"} type={"string"} required>
    Base64 ciphertext yang didekode sebelum dekripsi.
  </ParamField>

  <ParamField path={"key"} type={"string"} required>
    Key Base64 yang didekode sebelum diteruskan ke AES.
  </ParamField>

  <ParamField path={"iv"} type={"string"} required>
    Base64 IV yang didekode sebelum pemrosesan mode. Argumen ini wajib, termasuk untuk ECB.
  </ParamField>

  <ParamField path={"mode"} type={"\"CBC\" | \"ECB\" | \"AES-CBC\" | \"AES-ECB\""}>
    AES mode. Prefix AES- dihapus jika ada. Default-nya AES-CBC.
  </ParamField>

  ## Return

  <ResponseField name={"plaintext"} type={"string"}>
    Byte plaintext yang dikembalikan sebagai string Lua.
  </ResponseField>

  ## Contoh

  Dekripsi ciphertext yang dikembalikan oleh crypt.encrypt memakai IV yang dikembalikan.

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