Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the CRC32 polynomial in JAVA

Tags:

java

crc32

I need to use a different polynomial for JAVA's CRC32 implementation. I need to use CRC32Q, whose polynomial is 0x814141AB.

Is there any way to change the used polynomial, maybe extending the java.util.zip.CRC32 class?

like image 908
Roman Rdgz Avatar asked Feb 17 '26 06:02

Roman Rdgz


1 Answers

The CRC calculation is a native method (see grepcode) and there does not appear to be any way of plugging in a different implementation. You likely will have to write your own class implementing the Checksum interface. It will probably be a lot slower.

like image 102
Jim Garrison Avatar answered Feb 18 '26 20:02

Jim Garrison



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!