Generic Java language CRC implementation (includes CRC16, CRC32, CRC64, etc). With more than 170 predefined CRC like: CRC-32/ISO-HDLC, CRC-64/ECMA-182 & CRC-8/SMBUS
CrcDescription crcDescription = new CrcDescription(3, 0x3, 0x0, false, false, 0x7);
CRC crc = crcDescription.getCRC();
crc.update("StringA".getBytes());
long crcValue = crc.getCrc();
CrcDescription crcDescription = new CrcDescription(3, 0x3, 0x0, false, false, 0x7);
long crc = crcDescription.getCRC().update("StringA".getBytes()).getCrc();
CrcModel crcModel = CrcModel.lookUp("CRC-16/ARC");
String str1 = "StringABC";
String str2 = "StringBCD";
CRC crc = crcModel.getCRC(str1.getBytes());
crc.update(str2.getBytes());
long crcValue = crc.getCrc();
CrcModel crcModel = CrcModel.lookUp("CRC-16/ARC");
String str1 = "StringABC";
String str2 = "StringBCD";
long crc1a = crcModel.getCRC().update(str1.getBytes()).update(str2.getBytes()).getCrc();
long crc1b = crcModel.getCRC(str1.getBytes()).update(str2.getBytes()).getCrc();
long crc2 = new CRC(crcModel, crcModel.getCRC(str1.getBytes()).getCrc(), str1.length()).update(str2.getBytes()).getCrc();
long crc3 = crcModel.getCRC((str1+str2).getBytes()).getCrc();
In the all cases values has to be the same
Crc Model is an object for usage of CrcDescription with name and check code.
CrcDescription crcDescription = new CrcDescription(3, 0x3, 0x0, false, false, 0x7);
CrcModel crcModel = CrcModel.construct(crcDescription);
# >>> or:
CrcModel crcModel = CrcModel.construct("MyModel", crcDescription);
# >>> or:
long checkCode = 0x4L;
CrcModel crcModel = CrcModel.construct("MyModel", crcDescription, checkCode);
P.S.> The checkValue will be calculated if it is not defined.
CrcModel crcModel = CrcModel.CRC64_GO_ISO;
long crc = crcModel.getCRC().update("String".getBytes()).getCrc();
CrcModel crcModel = CrcModel.lookUp("CRC-16/ARC");
if (crcModel != null) {
long crc=crcModel.getCRC().update("String".getBytes()).getCrc();
}