| | |
cyclic codes help
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2008
Posts: 62
Reputation:
Solved Threads: 0
Hi,
I need help with implementing cyclic codes.Its much like crc.I've found a lot of software implementations for crc but havent understood them.I've looked at a crc guide which gave,
I havent understood how this works.
I've also looked at this algorithm...
if someone could give me a basic idea of how this works I'd really appreciate it
I need help with implementing cyclic codes.Its much like crc.I've found a lot of software implementations for crc but havent understood them.I've looked at a crc guide which gave,
C++ Syntax (Toggle Plain Text)
So to implement CRC division, we have to feed the message through a division register. At this point, we have to be absolutely precise about the message data. In all the following examples the message will be considered to be a stream of bytes (each of 8 bits) with bit 7 of each byte being considered to be the most significant bit (MSB). The bit stream formed from these bytes will be the bit stream with the MSB (bit 7) of the first byte first, going down to bit 0 of the first byte, and then the MSB of the second byte and so on. With this in mind, we can sketch an implementation of the CRC division. For the purposes of example, consider a poly with W=4 and the poly=10111. Then, the perform the division, we need to use a 4-bit register: 3 2 1 0 Bits +---+---+---+---+ Pop! <-- | | | | | <----- Augmented message +---+---+---+---+ 1 0 1 1 1 = The Poly (Reminder: The augmented message is the message followed by W zero bits.) To perform the division perform the following: Load the register with zero bits. Augment the message by appending W zero bits to the end of it. While (more message bits) Begin Shift the register left by one bit, reading the next bit of the augmented message into register bit position 0. If (a 1 bit popped out of the register during step 3) Register = Register XOR Poly. End The register now contains the remainder.
I havent understood how this works.
I've also looked at this algorithm...
C++ Syntax (Toggle Plain Text)
unsigned int wombat(unsigned char *data, int len) { unsigned int result; int i,j; unsigned char octet; result = -1; for (i=0; i<len; i++) { octet = *(data++); for (j=0; j<8; j++) { if ((octet >> 7) ^ (result >> 31)) { result = (result << 1) ^ QUOTIENT; } else { result = (result << 1); } octet <<= 1; } } return ~result; /* The complement of the remainder */ }
if someone could give me a basic idea of how this works I'd really appreciate it
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
read the following pages and you should be ok:
http://www.relisoft.com/science/CrcMath.html
http://www.relisoft.com/science/CrcNaive.html
http://en.wikipedia.org/wiki/Cyclic_...utation_of_CRC
http://www.relisoft.com/science/CrcOptim.html
http://www.relisoft.com/science/CrcMath.html
http://www.relisoft.com/science/CrcNaive.html
http://en.wikipedia.org/wiki/Cyclic_...utation_of_CRC
http://www.relisoft.com/science/CrcOptim.html
![]() |
Other Threads in the C++ Forum
- Previous Thread: Dev C++ error
- Next Thread: Using variable as filename
| Thread Tools | Search this Thread |
api array beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count data database delete desktop developer directshow dll download dynamic email encryption error file forms fstream function functions game getline google graph gui homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text text-file tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






