Skip to main content

+1 866 653-6233 LinkedIn Software Expert Witness Directory

About Us Contact Us

Barr Group Software Experts

Barr Group Software Experts

Main navigation

  • Expert Services
    • Consulting Experts in Software and Electronics
    • Expert Reports by Testifying Software Experts
    • Reverse Engineering and Forensic Analysis
    • Software Source Code Review and Analysis
  • Areas of Expertise
    • Left Side
      • Artificial Intelligence
      • Automotive Systems
      • Cloud Computing
      • Computer Security
      • Consumer Electronics
      • Electronic Circuits
      • Enterprise Software
      • Financial Technology
      • Firmware and IoT
    • Right Side
      • Industrial Controls
      • Mechanical Design
      • Medical Devices
      • Military & Aerospace
      • Mobile Devices & Apps
      • Optical Equipment
      • Renewable Energy
      • Signal Processing
      • Telecommunications
  • Matters & Venues
    • Patent Infringement and Invalidity Experts
    • Software Copyright and Trade Secrets Experts
    • Product Liability and Failure Analysis Experts
    • Contract Disputes and Software Project Failures
    • Venues and Clients
  • Directory
  • Case Studies
    • DirecTV Anti-Piracy
    • Samsung Software Copyright
    • Toyota Runaway Cars
  • Resources
    • Expert Witness Blog
    • Source Code Review in Litigation
    • Software Source Code Discovery

Checksums and CRCs

  1. Home
  2. Tech Talks
  3. Checksums and CRCs

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.

Embedded software expert 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++

Transcript

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 barrgroup.com, 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.  

Request an Expert

(866) 653-6233

Barr Group logo
Call us

Expert Services

  • Source Code Review Services
  • Expert Witness Directory
  • Reverse Engineering Services
  • Expert Reports & Testimony
  • How-To Technical Articles
  • Engineering Services

Latest Insights

  • Payment Processing and e-Payments Fraud
  • Albert Einstein Expert Witness
  • Medical Device Litigation and FDA 510(k)
  • Personality Traits of the Best Expert Witnesses

Website contents copyright © 2012-2025 by Barr Group. | Barr Group's logo is a U.S.-registered ® trademark.

SITEMAP  |  PRIVACY