Is there any library/code in Java to calculate the 32-bit CRC of a stream of bytes in a way thats consistent with the cksum command in unix ?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Jacksum: http://www.jonelo.de/java/jacksum/index.html
It's open source.
Have you tried the CRC32 class?
http://download.oracle.com/javase/7/docs/api/java/util/zip/CRC32.html
This is the crc 32 which gzip uses.
Carlos Rendon's statement, "I can verify that Java's CRC32 is NOT the same as /usr/bin/cksum", is incorrect.
As Peter Lawrey mentioned, you can use Java's CRC32 directly to get the same checksum as Unix/Linux
cksum
.The correct way to do it is:
Source: http://introcs.cs.princeton.edu/java/61data/CRC32.java.html