« mcrypt_create_iv
mcrypt_enc_get_algorithms_name »

mcrypt_decrypt

(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)

mcrypt_decrypt — Decrypts crypttext with given parameters

警告

この関数は PHP 7.1.0 で 非推奨となり、PHP 7.2.0 で削除 されました。この関数に頼らないことを強く推奨します。

説明

function mcrypt_decrypt(
    string $cipher,
    string $key,
    string $data,
    string $mode,
    string $iv = ?
): string|false

Decrypts the data and returns the unencrypted data.

パラメータ

cipher

MCRYPT_暗号名 定数のいずれか、 あるいはアルゴリズム名をあらわす文字列。

key

The key with which the data was encrypted. If the provided key size is not supported by the cipher, the function will emit a warning and return false

data

The data that will be decrypted with the given cipher and mode. If the size of the data is not n * blocksize, the data will be padded with '\0'.

mode

定数 MCRYPT_MODE_モード名、あるいは文字列 "ecb", "cbc", "cfb", "ofb", "nofb" ,"stream" のいずれか。

iv

CBC, CFB, OFB モードおよび STREAM モードのいくつかのアルゴリズムの初期化の際に使用されます。 指定した IV のサイズがそのモードでサポートされていない場合、 あるいは IV を必要とするモードで IV が指定されなかった場合は、 この関数は警告を発して false を返します。

戻り値

Returns the decrypted data as a string 失敗した場合に false を返します.

参考

  • mcrypt_encrypt() - 指定したパラメータでプレーンテキストを暗号化する
関連キーワード:
mcrypt   モード   Decrypts   given   cipher   crypttext   parameters   decrypt   mode   定数   アルゴリズム   size   decrypted   create   algorithms   Mcrypt   非推奨   推奨   unencrypted   暗号   encrypted   provided   supported   emit   warning
関連する関数・ページ:
function.mcrypt-get-iv-size   function.mcrypt-get-key-size   function.mcrypt-get-cipher-name   function.mcrypt-get-block-size   function.mcrypt-module-close   function.mcrypt-enc-get-modes-name