Java Utililty Methods CRC Calculate

List of utility methods to do CRC Calculate

Description

The list of methods to do CRC Calculate are organized into topic(s).

Method

Stringcrc32(String input)
crc
long CRC = 0xffffffff;
input = input.toLowerCase();
char[] data = input.toCharArray();
for (int j = 0; j < data.length; j++) {
    int c = data[j];
    CRC ^= c << 24;
    for (int i = 0; i < 8; i++) {
        if ((CRC & 0x80000000L) != 0) {
...
intcrc320(byte[] buf, int off, int len)
crc
return update(buf, off, len) ^ 0xFFFFFFFF;
intcrc321(byte[] buf, int off, int len)
crc
int crc = 0xffffffff;
while (len-- != 0) {
    crc ^= buf[off++] & 0xFF;
    for (int i = 0; i < 8; i++) {
        if ((crc & 1) == 1) {
            crc >>>= 1;
            crc ^= 0xEDB88320;
        } else
...
intcrc32Hash(String key)
crc Hash
int n = key.length();
int hash = n;
for (int i = 0; i < n; ++i)
    hash = (hash >> 8) ^ crctab[(hash & 0xff) ^ key.charAt(i)];
return hash;
longcrc64(String value)
crc
long crc = 0xFFFFFFFFFFFFFFFFL;
byte[] buffer = value.getBytes();
int tab_index = 0;
for (int i = 0; i < buffer.length; i++) {
    tab_index = ((int) (crc >> 56) ^ buffer[i]) & 0xFF;
    crc = CRC64_TABLE[tab_index] ^ (crc << 8);
return ((long) (crc ^ 0xFFFFFFFFFFFFFFFFL) & 0xFFFFFFFFFFFFFFFFL);
...
bytecrc8(byte data, byte crcInit, byte poly)
CRC calculation
byte crc;
byte polynom;
int i;
crc = crcInit;
for (i = 0; i < 8; i++) {
    if ((uint(crc) & 0x80) != 0) {
        polynom = poly;
    } else {
...
intcrc8(String value)
crc
int crc = 0;
byte[] buffer = value.getBytes();
for (int i = 0; i < buffer.length; i++) {
    crc = CRC8_TABLE[buffer[i] ^ (crc & 0xFF)];
return crc;
bytecrc8_tab(byte data, byte crcInit)
CRC calculation with tab operations
short ci = (short) (crcInit & 0xFF);
byte crc = (byte) (CRC_TAB_8_VALUE[ci] ^ (data & 0xFF));
return crc;
voidcrc8PushByte(int[] crc, byte add)
crc Push Byte
int addInt = (add & 0x000000FF);
crc[0] = crc[0] ^ addInt;
for (int i = 0; i < 8; i++) {
    if ((crc[0] & 0x00000001) != 0x00000000) {
        crc[0] = (crc[0] >> 1) ^ 0x0000008C;
    } else {
        crc[0] = (crc[0] >> 1);
intcrcUpdate(int old, int value)
crc Update
int c = old ^ value;
for (int i = 0; i < 8; ++i) {
    if ((c & 1) > 0)
        c = ((c >> 1) ^ 0xA001);
    else
        c = (c >> 1);
return c;
...