WORD key=1;
CString str;//已赋值
CString strRet;strRet=str;
for(i=0;i<str.GetLength();i++)
{
strRet.SetAt(i,str.GetAt(i)^(key>>8));
key=((BYTE)strRet.GetAt(i)+key)*10+10;
}越详细越好,因为我需要改成VB代码。测试成功即结帖,高手帮忙,在线等!
CString str;//已赋值
CString strRet;strRet=str;
for(i=0;i<str.GetLength();i++)
{
strRet.SetAt(i,str.GetAt(i)^(key>>8));
key=((BYTE)strRet.GetAt(i)+key)*10+10;
}越详细越好,因为我需要改成VB代码。测试成功即结帖,高手帮忙,在线等!
WORD key = 1;
CString str;
LPSTR strRet = str.GetBuffer(0);
int length = str.GetLength();
for (i=0; i <length; i++)
{
strRet[i] ^= (key >> 8);
key = ((BYTE)strRet[i] + key) * 10 + 10;
}
dim str as String;
dim strRet as String;
dim i as longstr = StrConv(str, vbFromUnicode);
strRet = str
for i = 1 to lenb(str)
mid(strRet,i,1) = chr(Asc(mid(str,i,1)) xor (key \ 256))
key = ((Asc(mid(strRet,i,1))+Key) * 10& + 10&) and 65535
next i
dim str as String;
dim strRet as String;
dim i as longstrRet = str
for i = 1 to len(str)
mid(strRet,i,1) = chr(Asc(mid(str,i,1)) xor (key \ 256))
key = ((Asc(mid(strRet,i,1))+Key) * 10& + 10&) and 65535
next i
dim str as String;
dim strRet as String;
dim i as longstr = StrConv(str, vbFromUnicode);
strRet = str
for i = 1 to LenB(str)
MidB(strRet,i,1) = ChrB(AscB(MidB(str,i,1)) xor (key \ 256))
key = ((AscB(MidB(strRet,i,1))+Key) * 10& + 10&) and 65535
next i
strRet = StrConv(strRet, vbUnicode);