From 121076765f79524dd99af8ce495b891fe8422686 Mon Sep 17 00:00:00 2001 From: Zilog80 Date: Mon, 8 Feb 2021 21:43:41 +0100 Subject: [PATCH] crc_polymod: input bugfix --- ecc/crc_polymod.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ecc/crc_polymod.c b/ecc/crc_polymod.c index e631e03..25f5ded 100644 --- a/ecc/crc_polymod.c +++ b/ecc/crc_polymod.c @@ -8,7 +8,7 @@ // CRC16 // Generatorpolynom x^16+x^12+x^5+1 = (1) 0001 0000 0010 0001 = 0x(1)1021 #define CRC 16 -#define CODELEN_CRC (2*0xDF) +#define CODELEN_CRC 1024 //(2*0xDF) unsigned char msg[CODELEN_CRC], par[8]; char bitstr[CODELEN_CRC*8+1+32*8]; @@ -83,7 +83,7 @@ int polymodcheck(char *x) { } unsigned int crc16(unsigned char bytes[], int len) { - unsigned int rem = crc16init; // init value + unsigned int rem = crc16init; // init value int i, j; for (i = 0; i < len; i++) { rem = rem ^ (bytes[i] << 8); @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) { if (option == CRC) { msglen = strlen(str)/2; - if (msglen > 2*CODELEN_CRC) { + if (msglen > CODELEN_CRC) { fprintf(stderr, "len > %d\n", CODELEN_CRC); return -3; }