异或加密的问题,在线等。。。。。。。
是这样异或的byte[] bKey = Common.tobyte("as3ad6f77saa");
byte[] bOutput = new byte[bInput.Length];
for (int i = 0; i < bInput.Length; i++)
{
if (i >= bKey.Length)
{
bOutput[i] = (byte)(bInput[i] ^ bKey[i - bKey.Length]);
}
else
{
bOutput[i] = (byte)(bInput[i] ^ bKey[i]);
}
}
return bOutput;
英文字符、数字都没有问题。
当加密中文,进行解密的时候,解密出来的内容就变成乱码了
不知道是什么原因呢 --------------------编程问答-------------------- 使用的对称算法吗? --------------------编程问答-------------------- 是这样的。。。。 --------------------编程问答-------------------- 解密: byte[] bInput = new byte[cipherText.Length / 2];
for (int i = 0; i < bInput.Length; i++)
{
bInput[i] = Convert.ToByte(cipherText.Substring(i * 2, 2), 16);
}
byte[] bOutput = GetXor(id, bInput);
return System.Text.Encoding.Default.GetString(bOutput);
--------------------编程问答-------------------- 求指教啊
补充:.NET技术 , ASP.NET