Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

crc 32 code explaination

Status
Not open for further replies.

aravind21tech

Newbie level 4
Joined
Jul 28, 2014
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
36
Hi all,
In the link below, CRC-32 is implemented in "C"
https://rosettacode.org/wiki/CRC-32#C

I can understand that 256 table entries are calculated. But I cannot get these 4 lines in that code


Code C - [expand]
1
2
3
4
5
q = buf + len;
for (p = buf; p < q; p++) {
    octet = *p;  
    crc = (crc >> 8) ^ table[(crc & 0xff) ^ octet];
}



Normally in finding CRC bits are shifted 1 by 1. But 8 bits are shifted here.

Can some one elaborate the reason why 8 bits are shifted?

Why a 256 entries table is calculated?

What I meant is I can just interpret the code, but cannot able to match it with normal binary CRC calculation method.
 
Last edited:

Processing 8 bits at a time using a properly constructed table is mathematically equivalent to the one bit at a time method, but much faster. To understand the equivalence you have to study the theory of the ring of polynomials with coefficients in GF(2). The CRC is just the remainder in that ring of dividing the message polynomial by the generating polynomial for that CRC.
 

Processing 8 bits at a time using a properly constructed table is mathematically equivalent to the one bit at a time method, but much faster. To understand the equivalence you have to study the theory of the ring of polynomials with coefficients in GF(2). The CRC is just the remainder in that ring of dividing the message polynomial by the generating polynomial for that CRC.

Thanks for the explaination, is there any link to learn about theory of ring of polynomials with coefficients in GF(2)
 

Just google Theory of CRC and click on the Wikipedia article. It should give you a good start.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top