private void DoVernam(byte[] inBytes, byte[] keyBytes, ref byte[] outBytes)
{
for (int i = 0; i < inBytes.Length; i++)
{
outBytes[i] = (byte)(inBytes[i] ^ keyBytes[i]);
}
}
private string VernamEn(string EncodeString ,byte[] key)
{
byte[] inBytes = Encoding.Default.GetBytes(EncodeString);
byte[] outBytes = new byte[inBytes.Length];
DoVernam(inBytes, keyBytes, ref outBytes);
return Convert.ToBase64String(outBytes);
}
EncodeString="userid=123456&username=123456&time=0"
key="NS6@D48:3DMJ@?BSVMNEO3925-36/8>NHDHK6?05E:YOJ<2X/5G.REKGG07D-.7T2X/VQPICIE-B4DBST43TK=V0R-124F4C/1IK:549F0>9E6@/H>IRT=6O/X0PLC<0"
这个代码是这样的。
我第一次接触这个弄了三天了。