Barr Group FacebookBarr Group TwitterBarr Group LinkedInBarr Group Vimeo

A checksum is a numerical check value calculated from a larger set of data. A checksum is most often used when sending a packet of data over a network or other communications channel. One checksum formula is a simple addition, with overflow ignored, wherein the bytes of the packet are added together into a variable of a fixed size/width (say, 16 bits) as they are sent. The checksum is typically sent at the end of the packet and used at the receiving end to confirm the integrity of the preceding data.

A CRC or cyclic redundancy check is based on division instead of addition. The error detection capabilities of a CRC make it a much stronger checksum and, therefore, often worth the price of additional computational complexity.

In this Tech Talk, Barr Group CTO Michael Barr discusses the importance of checksums and CRCs, and how you can integrate them into your code.

Download Barr Group's CRC Code-C (Free)

Related Articles

CRC Series, Part 1: Additive Checksums

CRC Series, Part 2: CRC Mathematics and Theory

CRC Series, Part 3: CRC Implementation Code in C/C++


Michael Barr:  This morning we’re talking about Checksums and CRCs.  A CRC which is short for a Cyclic Redundancy Code is a powerful type of a checksum.  A checksum is any sort of a mathematical operation that you can perform on data to make sure that the bits don’t get flipped accidentally when it’s stored in a memory or when it’s transmitted over to a network.  A CRC is a particularly powerful type of a checksum, mostly because it’s very difficult to fool a CRC.  So, CRCs are widely used.  One of the benefits of them is not only are they difficult to fool, but they’re relatively compact most are either 16 or 32 bits, so just taking up two or four bytes of additional storage. 

So, you might have a large packet that’s going to go out over to the network like a network packet for the Internet Protocol might be 1500 bytes long.  But you only need four additional bytes to store a 32-bit CRC to ensure that the data has not been corrupted.  It’s not universally perfect, but mathematically it’s very difficult to fool.  There are lots of – CRC is just a general concept.  There is lots of – it’s a mathematical process, but there are different specific algorithms or formulas that you can apply based on what’s known as the generator polynomial.  And so, one of the standards that’s widely used is what’s called the CRC-32 written like this and that’s the standard CRC-32 meaning 32 bits that is used widely over the internet for ensuring that data is accurate.  But there are others as well including 16-bit CRCs and a variety of different generator polynomials and other specific techniques.

One of the things that’s tricky for engineers when you’re going to implement a CRC is that if you’re using a general purpose processor or even a pen and a paper, computing a CRC is complex mathematically, because it operates on something that’s called Modulo-2 addition which is the kind of binary arithmetic.  And you can build special dedicated hardware to do this quickly and sometimes you see that.  But if you’ve got to write it in your C program or your C++ program for embedded systems it can be tricky and it’s something that you shouldn’t waste your time doing because there are existing solutions for it. 

On our website at, you’ll find three very popular articles about CRCs explaining what they are, how they work and what the property’s protection are.  Also, how to implement them in C and along with the how to implement them in C article is resource code that I wrote about 15 years ago and has been used by thousands of embedded software engineers and it’s probably deployed in millions of systems already.  And it’s been proven time and time again to implement CRCs of specific polynomials. You can choose the polynomial or change it to your liking.  This is easy to use and it’s a good reusable code that’s available for free on our website for your download.  

Watch More Tech Talks

What’s happening and how it’s done. Get in the know.

Sign up for our newsletter today!

Receive free how-to articles, industry news, and the latest info on Barr Group webinars and training courses via email. 

To prevent automated spam submissions leave this field empty.