在某位大师的指导要求下,刚把今天代码做ending的我,来看一下mcrypt,安装就不说了,
extension=php_mcrypt.dll
加密算法
Mcrypt支持的算法有:
cast-128,gost,rijndael-128,twofish,arcfour,cast-256,loki97,rijndael-192,saferplus,wake,blowfish-compat,des,rijndael-256,serpent,xtea,blowfish,enigma,rc2,tripledes
加密模式
Mcrypt支持的加密模式有:
cbc,cfb,ctr,ecb,ncfb,nofb,ofb,stream
1 $cipher='xtea'; 2 $key='Sir'; 3 $data='I Love You !'; 4 $mode='ecb'; 5 $encStr=mcrypt_encrypt($cipher,$key,$data,$mode);//加密
6 print_r($encStr);
1 $cipher='xtea'; 2 $key=''; 3 $data='I Love You !'; 4 $mode='ecb'; 5 $encStr=mcrypt_encrypt($cipher,$key,$data,$mode); 6 print_r($encStr);
$key:将和data一起被加密,密钥
1 $cipher='xtea'; 2 $key=''; 3 $data='I Love You !'; 4 $mode='ecb'; 5 $encStr=mcrypt_encrypt($cipher,$key,$data,$mode);//编码 6 $decStr=mcrypt_decrypt($cipher, $key,$encStr , $mode);//解码 7 print_r($encStr); 8 9 print_r($decStr);
我刚开始看,看帮助手册吧,