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

> Odszyfrowuje Base64 ciphertext za pomoca key zdekodowanego z Base64 i wymaganego Base64 IV, uzywajac AES CBC albo 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
  ```

  ## Argumenty

  <ParamField path={"data"} type={"string"} required>
    Base64 ciphertext dekodowany przed odszyfrowaniem.
  </ParamField>

  <ParamField path={"key"} type={"string"} required>
    Key Base64 dekodowany przed przekazaniem do AES.
  </ParamField>

  <ParamField path={"iv"} type={"string"} required>
    Base64 IV dekodowany przed obsluga mode. Ten argument jest wymagany, takze dla ECB.
  </ParamField>

  <ParamField path={"mode"} type={"\"CBC\" | \"ECB\" | \"AES-CBC\" | \"AES-ECB\""}>
    AES mode. Prefix AES- jest usuwany, gdy wystepuje. Wartosc domyslna to AES-CBC.
  </ParamField>

  ## Zwroty

  <ResponseField name={"plaintext"} type={"string"}>
    Bajty plaintext zwracane jako Lua string.
  </ResponseField>

  ## Przykład

  Odszyfruj ciphertext zwrocony przez crypt.encrypt, uzywajac zwroconego 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>
