关于一段php函数改写成asp的问题

来源:百度知道 编辑:UC知道 时间:2024/05/31 09:57:52
函数如下是discuz的cookie解码函数,怎么改写成asp的?
function authcode($string, $operation) {
global $_SERVER, $_DCACHE;

require_once './forumdata/cache/cache_settings.php';
$discuz_auth_key = md5($_DCACHE['settings']['authkey'].$_SERVER['HTTP_USER_AGENT']);

$coded = '';
$keylength = strlen($discuz_auth_key);
$string = $operation == 'DECODE' ? base64_decode($string) : $string;
for($i = 0; $i < strlen($string); $i += $keylength) {
$coded .= substr($string, $i, $keylength) ^ $discuz_auth_key;
}
$coded = $operation == 'ENCODE' ? str_replace('=', '', base64_encode($coded)) : $coded;
return $coded;
}
后来自己又改了下,现在关键一点就是vbscript怎么对2个字符串进行异或操作

$_COOKIES[] 变成 response.cookies() ...

有点困难,VBS 不提供 MD5 之类的函数。

ASP运用MD5函数对字符串进行加密
http://www.web745.com/article_html/2006/09/123.html