加密函数:string mcrypt_encrypt ( string $cipher
, string $key
, string $data
, string $mode
[, string $iv
] )
解密函数:string mcrypt_decrypt ( string $cipher
, string $key
, string $data
, string $mode
[, string $iv
] )
# $cipher:算法名称,有些算法名称是在某些平台上不能使用,下面列出这里可用的算法名称MCRYPT_3DES、MCRYPT_ARCFOUR_IV (libmcrypt > 2.4.x only)、MCRYPT_ARCFOUR (libmcrypt > 2.4.x only)、MCRYPT_BLOWFISH、MCRYPT_CAST_128、MCRYPT_CAST_256、MCRYPT_CRYPT、MCRYPT_DES、MCRYPT_DES_COMPAT (libmcrypt 2.2.x only)、MCRYPT_ENIGMA (libmcrypt > 2.4.x only, alias for MCRYPT_CRYPT)、MCRYPT_GOST、MCRYPT_IDEA (non-free)、MCRYPT_LOKI97 (libmcrypt > 2.4.x only)、MCRYPT_MARS (libmcrypt > 2.4.x only, non-free)、MCRYPT_PANAMA (libmcrypt > 2.4.x only)、MCRYPT_RIJNDAEL_128 (libmcrypt > 2.4.x only)、MCRYPT_RIJNDAEL_192 (libmcrypt > 2.4.x only)、MCRYPT_RIJNDAEL_256 (libmcrypt > 2.4.x only)、MCRYPT_RC2、MCRYPT_RC4 (libmcrypt 2.2.x only)、MCRYPT_RC6 (libmcrypt > 2.4.x only)、MCRYPT_RC6_128 (libmcrypt 2.2.x only)、MCRYPT_RC6_192 (libmcrypt 2.2.x only)、MCRYPT_RC6_256 (libmcrypt 2.2.x only)、MCRYPT_SAFER64、MCRYPT_SAFER128、MCRYPT_SAFERPLUS (libmcrypt > 2.4.x only)、MCRYPT_SERPENT(libmcrypt > 2.4.x only)、MCRYPT_SERPENT_128 (libmcrypt 2.2.x only)、MCRYPT_SERPENT_192 (libmcrypt 2.2.x only)、MCRYPT_SERPENT_256 (libmcrypt 2.2.x only)、MCRYPT_SKIPJACK (libmcrypt > 2.4.x only)、MCRYPT_TEAN (libmcrypt 2.2.x only)、MCRYPT_THREEWAY、MCRYPT_TRIPLEDES (libmcrypt > 2.4.x only)、MCRYPT_TWOFISH (for older mcrypt 2.x versions, or mcrypt > 2.4.x )、MCRYPT_TWOFISH192、MCRYPT_TWOFISH256、MCRYPT_WAKE (libmcrypt > 2.4.x only)、MCRYPT_XTEA (libmcrypt > 2.4.x only)
# $key:加密时的密钥,不要超过当前算法所支持的最大的密钥长度
# $data:需要加密的数据
# $mode:加密的模式,MCRYPT_MODE_ECB、MCRYPT_MODE_CBC、MCRYPT_MODE_CFB、MCRYPT_MODE_OFBMCRYPT_MODE_NOFB、MCRYPT_MODE_STREAM
使用方法: