Back to Mcrypt class

Method decrypt

public string
decrypt
(mixed $cipherText, mixed $key)
Decrypt encrypted data
Parameters
  • string $cipherText Encrypted data
  • string $key Encryptionkey
Returns
  • string Plaintext data
Class: Mcrypt
Project: Joomla

Method decrypt - Source code

/**
 * Decrypt encrypted data
 *
 * @param   string  $cipherText  Encrypted data
 * @param   string  $key         Encryptionkey
 *
 * @return   string  Plaintext data
 */
public function decrypt($cipherText, $key)
{
    $iv_size = $this->getBlockSize();
    $key = $this->resizeKey($key, $iv_size);
    $iv = substr($cipherText, 0, $iv_size);
    $cipherText = substr($cipherText, $iv_size);
    $plainText = mcrypt_decrypt($this->cipherType, $key, $cipherText, $this->cipherMode, $iv);
    return $plainText;
}