Mcrypt 函数
PHP 手册

mcrypt_decrypt

(PHP 4 >= 4.0.2, PHP 5)

mcrypt_decryptDecrypts crypttext with given parameters

说明

string mcrypt_decrypt ( string $cipher , string $key , string $data , string $mode [, string $iv ] )

Decrypts the data and returns the unencrypted data.

参数

cipher

MCRYPT_ciphername 常量中的一个,或者是字符串值的算法名称。

key

The key with which the data was encrypted. If it's smaller than the required keysize, it is padded with '\0'.

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_modename 常量中的一个,或以下字符串中的一个:"ecb","cbc","cfb","ofb","nofb" 和 "stream"。

iv

在 CBC, CFB, OFB 模式中用于初始化过程,在 STREAM 模式中用于某些算法。如果未提供 IV 并且在某算法中需要,本函数发出一条警告并使用一个全部字节设为 "\0" 的 IV。

返回值

Returns the decrypted data as a string.


Mcrypt 函数
PHP 手册