cambler@polyslo.CalPoly.EDU (Fubar) (12/28/89)
Well, i seem to have found my problem. The remote system's checksum and
mine don't agree. Here is something i hacked up to test it. For me, this
returns 210A. For the remote system, after sending the same data, it
computer E5AB. Run here on the pyramid, i get 0040. Wahhhh!!!
--- cut here ---
#define MAGIC 0xAAAA
#include <stdio.h>
unsigned int checksum(data, len)
unsigned char *data; int len;
{
unsigned int i, j, tmp, a, b;
a = 0xffff;
b = 0;
j = len;
for (i = 0; i < len; i++) {
if(a & 0x8000) {
a <<= 1;
a++;
} else
a <<= 1;
tmp = a;
a += (data[i] & 0xff);
b += a ^ j;
if ((a & 0xffff) <= (tmp & 0xffff))
a ^= b;
j--;
}
return (a & 0xffff);
}
void main(void)
{
unsigned char ctrl;
unsigned sum;
int tt, xxx, yyy, size;
char data[64];
tt = 2;
xxx = 1;
yyy = 0;
size = 64;
strncpy(data, "S D.simpactA0619 D.simpactA0619 chris - D.simpactA0619 0666", 64);
ctrl = ((tt & 3) << 6) | ((xxx & 7) << 3) | (yyy & 7);
sum = MAGIC - (checksum(data, size) ^ ctrl);
printf("%i: %x\n", size, sum);
}
--- cut here ---
Any ideas?
--
Sig: ++Christopher(); | Fubar Systems BBS
Internet: cambler@polyslo.calpoly.edu | (805) 544-9234 3/12/24 8-N-1
Also: chris@fubarsys.slo.ca.us | San Luis Obispo, California
Bix: cambler | "G Protocol Sucks" -- Me.