diff --git a/circe-checksum/src/main/java/com/scurrilous/circe/checksum/Crc32cIntChecksum.java b/circe-checksum/src/main/java/com/scurrilous/circe/checksum/Crc32cIntChecksum.java index 40c60808233..65a77b1492b 100644 --- a/circe-checksum/src/main/java/com/scurrilous/circe/checksum/Crc32cIntChecksum.java +++ b/circe-checksum/src/main/java/com/scurrilous/circe/checksum/Crc32cIntChecksum.java @@ -46,6 +46,28 @@ public static int computeChecksum(ByteBuf payload) { return CRC32C_HASH.calculate(payload); } + /** + * Computes crc32c checksum: if it is able to load crc32c native library then it computes using that native library + * which is faster as it computes using hardware machine instruction else it computes using crc32c algo. + * + * @param payload + * @return + */ + public static int computeChecksum(ByteBuf payload, int offset, int len) { + return CRC32C_HASH.calculate(payload, offset, len); + } + + /** + * Computes incremental checksum with input previousChecksum and input payload + * + * @param previousChecksum : previously computed checksum + * @param payload + * @return + */ + public static int resumeChecksum(int previousChecksum, ByteBuf payload) { + return CRC32C_HASH.resume(previousChecksum, payload); + } + /** * Computes incremental checksum with input previousChecksum and input payload *