本帖最后由 manbutianya 于 2014-6-7 20:56 编辑
PHP:<?php
echo "hello";
echo "为什么不同";
$key="6N0Y6NI252N1KYCNN";
$userid= MdString($key,"122555@qq.com");
$password= MdString($key,"wu123456");
function MdString($key,$string){
$len = strlen($key);
for($i=0; $i<strlen($string); $i++)
{
$k = $i % $len;
$code .= $string[$i] ^ $key[$k];
echo"<br/>";
echo $i;
echo"<br/>";
echo $k;
echo"<br/>";
echo $code;
echo"<br/>";
echo"<br/>";
}
return base64_encode($code);
}
echo"<br/>";
echo $userid;
echo"<br/>";
echo $password;
?>
AU3:#PRE_UseX64=n
#include <Base64.au3>
#include <MsgBoxConstants.au3>
$key = "6N0Y6NI252N1KYCNN"
$userid = _MdString($key,"122555@qq.com")
$password = _MdString($key,"wu123456");
MsgBox(0, "用户名",$userid&@CRLF&$password)
Func _MdString($key,$string)
$len = StringLen($key) ;取字符串长度
Local $code = ""
For $i=0 To StringLen($string) Step 1
$k = Mod($i,$len) ;取模
;MsgBox(0, "用户密码",StringMid ($string, $i,1)&@CRLF&StringMid ($key, $k,1))
$code &= BitXOR(StringMid ($string, $i,1),StringMid ($key, $k,1))
MsgBox(0, "代码",$code)
Next
;MsgBox(0, "$k",$k)
$code = Base64($code,0);
Return $code
EndFunc
按位异或代码就不同了,有人能解决吗? |