有不有加密/解密字符串的函数? 我想通过 URL 传递?auth=DQAAAHEAAACLOUUMTleK_KZg9BWBB 在服务端上做加密解密的安全判断有扩展函数的请提供给我行吗? 谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 deshttp://hi.baidu.com/lael80/blog/item/58244460067226df8db10d94.html这里下载或者php.ini;extension=php_mcrypt.dll也有des加密,不过那个库要另外装的 自己利用 base64_encode() 和 base64_decode()可以写一个加密解密函数。 http://hi.baidu.com/lael80/blog/item/58244460067226df8db10d94.html这个挺好的。不过解密要加一个函数。先转换下再去解密。//16进制转换字符串function hexStr($hexStr){ $hexStr = "0x".wordwrap($hexStr, 2, ",0x", 1); $arrayHex = explode(",", $hexStr); $s=""; foreach($arrayHex as $hex){ eval( "\$str = chr($hex);"); $s.=$str; } return $s;} 作者 syrehttp://club.phpe.net/index.php?act=ST&f=6&t=13625&s=<?phpfunction zxcrypt($str, $code){ srand(crc32(md5($code))); $ret=''; $len=strlen($str); for($i=0; $i<$len; $i++){ $ret.=chr(rand(0,255) ^ ord($str[$i])); } return $ret;}echo zxcrypt(zxcrypt('hello world!', '12345'),'12345');?> http://hi.baidu.com/zjstandup/blog/item/82d960346a3d124f251f149b.html可逆加密函数不知道是不是你要的 /*************************** 函数功能:加密函数***************************/FUNCTION EnCode($code,$key){ $code=base64_encode($key."|".$code."|".$key); return $code;}// 结束/*************************** 函数功能:解密函数***************************/FUNCTION DeCode($code,$key){ $code=base64_decode($code); $code = substr($code,strlen($key)+1); $code = substr($code,0,-(strlen($key)+1)); return $code;}// 结束$key="|asdhewer";$char="字符串";echo "加密字符串:".$char."<BR>";echo "密钥字符串:".$key."<BR>";echo "加密后字符串:".EnCode($char,$key)."<BR>";echo "解密后字符串:".DeCode(EnCode($char,$key),$key)."<BR>"; 用base64_encode不错但是base64_encode产生的结果里会含有/与+字符所以要替换一下(比如替换成-与_等) 怎样用smarty的模板显示mysql数据库里的表格显示出来? 菜单问题 【急救~~】php error_reporting 或者 var_dump函数使用 出现空白页 这个问题不太好描述,主大家进来看一下能否实现。 图片文件备份的问题,在线等 求将MSSQL数据导入到MYSQL里,很急啊! php 文字问题 关于mysql两个急需解决的问题? 大哥哥快来帮我看看,这是扎个原因阿 烦劳大师帮帮小弟急死了, 求教linux下的文本编辑器 会员登陆的问题??
http://hi.baidu.com/lael80/blog/item/58244460067226df8db10d94.html这里下载或者php.ini
;extension=php_mcrypt.dll
也有des加密,不过那个库要另外装的
function hexStr($hexStr){
$hexStr = "0x".wordwrap($hexStr, 2, ",0x", 1);
$arrayHex = explode(",", $hexStr);
$s="";
foreach($arrayHex as $hex){
eval( "\$str = chr($hex);");
$s.=$str;
}
return $s;
}
function zxcrypt($str, $code){
srand(crc32(md5($code)));
$ret='';
$len=strlen($str);
for($i=0; $i<$len; $i++){
$ret.=chr(rand(0,255) ^ ord($str[$i]));
}
return $ret;
}
echo zxcrypt(zxcrypt('hello world!', '12345'),'12345');
?>
不知道是不是你要的
* 函数功能:加密函数
***************************/
FUNCTION EnCode($code,$key){
$code=base64_encode($key."|".$code."|".$key);
return $code;
}
// 结束/**************************
* 函数功能:解密函数
***************************/
FUNCTION DeCode($code,$key){
$code=base64_decode($code);
$code = substr($code,strlen($key)+1);
$code = substr($code,0,-(strlen($key)+1));
return $code;
}
// 结束
$key="|asdhewer";
$char="字符串";
echo "加密字符串:".$char."<BR>";
echo "密钥字符串:".$key."<BR>";
echo "加密后字符串:".EnCode($char,$key)."<BR>";
echo "解密后字符串:".DeCode(EnCode($char,$key),$key)."<BR>";
但是base64_encode产生的结果里会含有/与+字符
所以要替换一下(比如替换成-与_等)