bc-java icon indicating copy to clipboard operation
bc-java copied to clipboard

Add fast CRC-24 implementation

Open vanitasvitae opened this issue 3 years ago • 0 comments

The default CRC-24 implementation follows RFC4880, which proposes the use of an iterative algorithm. Mimicking a feedback shift register in software is inefficient.

In 'Computation of Cyclic Redundancy Checks via Table Look-Up' Dilip V. Sarwate proposes the use of lookup tables to speed up computation.

This PR implements such table lookup. By calling CRC24.setUseFastImplementation(true), the user can choose to use the fast implementation instead of the traditional one.

The fast algorithm can process 200mb of data in 3.6 seconds, compared to the iterative one which takes 4.9 seconds for the same data.

vanitasvitae avatar Jul 20 '22 14:07 vanitasvitae