Carlos Randonโs statement: โI can verify that Java CRC32 does not match / usr / bin / cksumโ is incorrect.
As Peter Laurie noted, you can use Java CRC32 directly to get the same checksum as Unix / Linux cksum .
The correct way to do this is:
java.util.zip.CRC32 x = new java.util.zip.CRC32(); x.update(bytes); StdOut.println("CRC32 (via Java library) = " + Long.toHexString(x.getValue()));
Source: http://introcs.cs.princeton.edu/java/61data/CRC32.java.html
The default CRC used is based on the polynomial used for checking CRC errors in the network standard ISO / IEC 8802-3: 1989.
Hitham S. AlQadheeb
source share