function encode_pass($tex,$key,$type="encode"){<BR> $chrArr=array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',<BR> 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',<BR> '0','1','2','3','4','5','6','7','8','9');<BR> if($type=="decode"){<BR> if(strlen($tex)<14)return false;<BR> $verity_str=substr($tex, 0,8);<BR> $tex=substr($tex, 8);<BR> if($verity_str!=substr(md5($tex),0,8)){<BR> //完整性验证失败<BR> return false;<BR> } <BR> }<BR> $key_b=$type=="decode"?substr($tex,0,6):$chrArr[rand()%62].$chrArr[rand()%62].$chrArr[rand()%62].$chrArr[rand()%62].$chrArr[rand()%62].$chrArr[rand()%62];<BR> $rand_key=$key_b.$key;<BR> $rand_key=md5($rand_key);<BR> $tex=$type=="decode"?base64_decode(substr($tex, 6)):$tex;<BR> $texlen=strlen($tex);<BR> $reslutstr="";<BR> for($i=0;$i<$texlen;$i++){<BR> $reslutstr.=$tex{$i}^$rand_key{$i%32};<BR> }<BR> if($type!="decode"){<BR> $reslutstr=trim($key_b.base64_encode($reslutstr),"==");<BR> $reslutstr=substr(md5($reslutstr), 0,8).$reslutstr;<BR> }<BR> return $reslutstr;<BR>}<BR>$psa=encode_pass("phpcode","taintainxousad");<BR>echo $psa<strong style="color:transparent">本&文来源gao@daima#com搞(%代@#码网@</strong><textarea>搞gaodaima代码</textarea>;<BR>echo encode_pass($psa,"taintainxousad",'decode');<BR>