该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
include
voidLFSR(unsigned char pzt[],unsigned char pjg[],int n)
{
unsigned char t=0;
int c=0,i;
for(i=0;i
t^=(pzt[i]&pjg[i]);
t^=((t<<1)^(t<<2)^(t<<3)^(t<<4)^(t<<5)^(t<<6)^(t<<7));
if (t&0x80) c=1;
for(i=n-1;i>=0;i--)
{
t=pzt[i];
pzt[i]=((t<<1)|c)&0xff;
c=(t&0x80)?1:0;
}
}
voidprint_2(int val2)
{
unsigned char *p = (unsignedchar*)&val2 + 3;
for(int k = 0; k <= 3; k++)
{
int val2 = *(p-k);
for (int i = 7; i >= 0; i--)
{
if(val2 & (1 <
printf("1");
else
printf("0");
}
printf(" ");
}
}
voidDSR(unsigned char pzt[],unsigned char pjg[],int n)
{
unsigned char t;
int c=0,i;
for(i=n-1;i>=0;i--)
{
t=pzt[i];
pzt[i]=((t<<1)|c)&0xff;
c=(t&0x80)?1:0;
}
if(c)
for(i=0;i
pzt[i]^=pjg[i];
}