How to Prepend Zeros to make CRC Whole Bytes

CRC without boundaries

circuit4u
5 min readApr 7, 2024

1. The Problem

CRC is a serial bit-wise algorithm from hardware point of view. Here are some helper sites that can generate Verilog/VHDL implementations given a CRC polynomial.

step-by-step calculator

On the other hand, to speed things up, CRC software libraries are often byte-wise based, using table look-up method.

Here is a good explanation how table look-up method works (link). For example, in Julia, you can specify any CRC polynomial method with the following parameters:

using CRC
mycrc5 = spec(5,0x05,0x1f,false,false,0x00,0x00)
@assert crc(mycrc5)([0x04,0x02])==0x14

Notice that the input data is an array of bytes.

Now the problem is how would you use the software library to calculate the corresponding CRC-5 of a 3-bit data 0b_111.

Here is a video showing manually doing it.

--

--

circuit4u
circuit4u

Written by circuit4u

memento of electronics and fun exploration for my future self

No responses yet