我想用不同的endian系统发送/接收加密数据 有可能的? 我听说这可能是相同的endian系统 xxtea代码是互联网上的xtea块...
#define MXA (((z>>5^y<<2) + (y>>3^z<<4)) ^ ((sum^y) + (xt_keyA[(p&3)^e] ^ z)))
void Encode(unsigned long *encode_data, unsigned char dataLength)
{
unsigned long y, z,sum;
unsigned long p, e,round;
dataLength=0;
round = 10;
sum = 0;
z = encode_data[1];
do {
sum += 0x12345678;
e = (sum >> 2) & 3;
for (p=0; p< 1; p++)
{
y = encode_data[p+1];
z = encode_data[p] += MXA;
}
y = encode_data[0];
z = encode_data[1] += MXA;
} while (--round);
}
void DecodeA(unsigned long *decode_data, unsigned char dataLength)
{
unsigned long y, z,sum;
unsigned long p, e;
dataLength=0;
sum = 10*0x12345678;
y = decode_data[0];
do {
e = (sum >> 2) & 3;
for (p=1; p>0; p--)
{
z = decode_data[p-1];
y = decode_data[p] -= MXA;
}
z = decode_data[1];
y = decode_data[0] -= MXA;
} while ((sum -= 0x12345678) != 0);
}