我想通过 URL 传递?auth=DQAAAHEAAACLOUUMTleK_KZg9BWBB 在服务端上做加密解密的安全判断有扩展函数的请提供给我行吗? 谢谢

解决方案 »

  1.   

    des
    http://hi.baidu.com/lael80/blog/item/58244460067226df8db10d94.html这里下载或者php.ini
    ;extension=php_mcrypt.dll
    也有des加密,不过那个库要另外装的
      

  2.   

    自己利用 base64_encode() 和 base64_decode()可以写一个加密解密函数。
      

  3.   

    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;
    }
      

  4.   

    作者 syrehttp://club.phpe.net/index.php?act=ST&f=6&t=13625&s=<?php
    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');
    ?>
      

  5.   

    http://hi.baidu.com/zjstandup/blog/item/82d960346a3d124f251f149b.html可逆加密函数
    不知道是不是你要的
      

  6.   

    /**************************
    * 函数功能:加密函数
    ***************************/
    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>";
      

  7.   

    用base64_encode不错
    但是base64_encode产生的结果里会含有/与+字符
    所以要替换一下(比如替换成-与_等)