**Philip Koopman, Carnegie Mellon University**

This is a C++ program that computes the maximum length achievable at a particular HD for a given CRC polynomial. It also computes examples codewords to show why the HD cannot be achieved at longer dataword lengths than computed.

- Source code: hdlen.cpp
- Directory save with test script: hdlen.tar.gz -- Run the "build.me" script to build and test the software.

**./hdlen <file.txt**- No parameters performs entire HD profile analysis of inputs.
- Example gives entire HD profile of hexadecimal polynomials in the file "file.txt" with one polynomial per line of the input file. Also works with interactive input (stdin).

**./hdlen 0x82608edb**- One parameter performs entire HD profile analysis of polyonmial given on command line
- Gives entire HD profile of CRC-32, which results in:

0x82608edb {4294967263,91607,2974,268,171,91,57,34,21,12,10,10,10}

**./hdlen 6 8 <file.txt**- Two parameters performs partial HD profile analysis of inputs.
- Gives partial HD profile (HD=6, HD=7, HD=8) of hexadecimal polynomials in the file "file.txt" with one polynomial per line of the input file. Also works with interactive input (stdin).

**./hdlen 0x82608edb 5 7**- Three parameters performs partial HD profile analysis of polyonmial given on command line.
- Gives partial HD profile of CRC-32 (HD=5, HD=6, HD=7), which results
in:

0x82608edb {?,?,2974,268,171,?,?,?,?,?,?,?,?}

Note: all polynomials are in implicit +1 format.

**# 0xea HD=3 len=85 Example: Len=86 {0} (0x80) (Bits=2)**- This polynomial has HD=3 up to and including dataword length 85.
- An example of a codeword that violates HD=3 is as follows:
- Length of dataword is 86 (codeword is therefore 86+8=94 bits long). The example length is always one bit longer than the maximum HD dataword length shown (i.e., 85+1=86). The last line of the per-HD data has a length of NONE, providing an example showing that the indicated HD cannot be supported by the polynomial at any length.
- Bit 0 is set (note that dataword bits are numbered 0..85). This is the first bit in the dataword, making it the bit furthest away from the FCS field. In other words, this bit has been cycled through a CRC shift register 86 times. The examples always have bit 0 set.
- The FCS from computing the CRC for this dataword is 0x80. In other words, this is the residual CRC computation value after computing the CRC over an 86 bit data word with all zeros except the first bit (bit 0)
- There are two bits set in this codeword (one bit from {0} plus one bit in the FCS value of 0x80=two bits), confirming HD=2 for this codeword

**0xea {85,85,2,2}**- 0xea is the polynomial
- {85,85,2,2} is the list of all lengths, and is a summary of the preceding lines.
- A "?" means that a particular HD length was not computed as a result of using the min/max HD input parameters

While significant effort has been spent on ensuring accuracy, ** USE OF
THIS SOFTWARE IS ENTIRELY AT YOUR OWN RISK.** All warranties and
assurances of fitness for purpose are disclaimed. In particular, this code has
NOT been developed to safety critical software standards. You have the source
code, so if you want to use this to validate CRC performance you should first
assure yourself that you trust the source code (probably with the compiled
optimization #define flag turned off). If someone has the resources and team
depth to certify this code to an appropriate SIL I'd be delighted to
redistribute that code. This source code is completely different than the
Hamming Weight evaluation code, and uses generally different algorithms. All
that having been said, if you find a bug let me know and I'll look into it as I
have time. If someone would like to perform independent review and evaluation
to ensure quality that would be great -- let me know.

Compiled with g++ 5.3.0 (GCC) with minimal library dependencies, but has
been updated to use of -std=c++11

More recently compiled with g++ 6.4.0 (GCC). ** If you're getting run time
errors please ensure that your copy of GCC is up to date.** In several
cases a GCC update has solved run-time problems.

The code is written to handle up to 64 bit CRCs. However, it is a brute force evaluation tool, so for large dataword lengths evaluation times can get long. 32-bit polynomials can be evaluated within reasonable time with a few particular HD value exceptions. Special case code for HD=3 and HD=4 evaluation helps, but does not attempt to exploit analytic properties of primitive polynomials.

This web page and all data files are Copyrighted 2015-2017 by Philip Koopman, Carnegie Mellon University.

This work is licensed under a
Creative
Commons Attribution 4.0 International License.

Please note that if any data errors or other issues are identified they will be updated at this page, but not necessarily anywhere that has copied these results. Therefore, you should always confirm at this URL: http://users.ece.cmu.edu/~koopman/crc/ that you have the most current version of data before using it.

Change log:

- 7/26/2015: Version 1.0.0 and test files released
- 8/27/2016: Version 1.1.0 and test files released; updated for C++11 and compiles clean with additional warning flags enabled.