Copy Code code as follows:
function Encode_pass ($tex, $key, $type = "encode") {
$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 ',
' 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 ',
' 0 ', ' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 ', ' 6 ', ' 7 ', ' 8 ', ' 9 ');
if ($type = = "Decode") {
if (strlen ($tex) <14) return false;
$verity _str=substr ($tex, 0,8);
$tex =substr ($tex, 8);
if ($verity _str!=substr (MD5 ($TEX), 0,8)) {
Integrity Verification Failed
return false;
}
}
$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];
$rand _key= $key _b. $key;
$rand _key=md5 ($rand _key);
$tex = $type = = "Decode" Base64_decode (substr ($tex, 6)): $tex;
$texlen =strlen ($tex);
$reslutstr = "";
for ($i =0; $i < $texlen; $i + +) {
$reslutstr. = $tex {$i}^ $rand _key{$i%32};
}
if ($type!= "decode") {
$reslutstr =trim ($key _b.base64_encode ($reslutstr), "= =");
$reslutstr =SUBSTR (MD5 ($RESLUTSTR), 0,8). $reslutstr;
}
return $reslutstr;
}
$PSA =encode_pass ("Phpcode", "Taintainxousad");
Echo $PSA;
Echo Encode_pass ($PSA, "Taintainxousad", ' decode ');