求异或加密内容的函数,等送分!!!
求异或加密内容的函数,等送分!!! xor应用 --------------------编程问答--------------------'提供一个最简单的异或加密,容易被破解哦--------------------编程问答-------------------- --------------------编程问答-------------------- private void Encrypt(string str,string key)
'在记事本手写的代码,没调试,你调试一下
public function Encrypt(byval strText as string, byval strKey as string) as string
dim strRet=string.empty
dim i as integer=0
for each c as char in strText
if(i>=strKey.Length)
i=0
end if
strRet += str(asc(c) xor asc(strKey(i)))
i+=1
next
return strRet
end function
{
byte[] buffer= Encoding.Default.GetBytes(str);
byte c;
for (int i = 0; i < buffer.Length; i++)
{
c= buffer[i];
buffer[i] = (byte) (c^ key[i % key.length]);
}
}
--------------------编程问答-------------------- 没调试,手写的too
public function GetCheckSum(byval data as byte()) as byte--------------------编程问答-------------------- 学习一下. --------------------编程问答-------------------- 学习一下. --------------------编程问答-------------------- 呃。。。顶。。。。。。不过.NET提供了加密解密方法。。。
dim checksum as byte = 0
for each b as byte in data
checksum = checksum xor b
next
return checksum
end function
补充:.NET技术 , VB.NET