public static function Crypt($str, $key=false) { $res = ''; if($key===false) $key = COption::GetOptionString("main", "pwdhashadd", ""); $key1 = CMailUtil::BinMD5($key); while($str) { $m = CUtil::BinSubstr($str, 0, 16); $str = CUtil::BinSubstr($str, 16); $res .= CMailUtil::ByteXOR($m, $key1, 16); $key1 = CMailUtil::BinMD5($key.$key1.$m); } return(base64_encode($res)); }
function Crypt($str, $key = false) { if ($key === false) { $key = COption::GetOptionString("main", "pwdhashadd", ""); } $key1 = CMailUtil::BinMD5($key); while ($str) { $m = substr($str, 0, 16); $str = substr($str, 16); $res .= CMailUtil::ByteXOR($m, $key1, 16); $key1 = CMailUtil::BinMD5($key . $key1 . $m); } return base64_encode($res); }