Package de.das.encrypter.tools
Class CRC
java.lang.Object
de.das.encrypter.tools.CRC
This class includes the methods to calculate the CRC's.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intCRC_16_byte(int prevValue, byte nextByte) Method which belongs to the calculation of 16-Bit CRC.static longCRC_32_byte(long prevValue, byte nextByte) Processing of one byte to create a CRC-32 value for a byte array.static intgetCRC_16(byte[] data) static intgetCRC_16(byte[] data, int ignore) Generates a CRC16 checksum for the given byte array without the number of bytes specified by the value "ignore" at the end of the byte array.static longgetCRC_32(byte[] data) Method to determine the CRC-32 values for a given byte array.static longgetCRC_32(byte[] data, int omit) Method to determine the CRC-32 values for a given byte array.
-
Constructor Details
-
CRC
public CRC()
-
-
Method Details
-
getCRC_16
public static int getCRC_16(byte[] data) -
getCRC_16
public static int getCRC_16(byte[] data, int ignore) Generates a CRC16 checksum for the given byte array without the number of bytes specified by the value "ignore" at the end of the byte array.- Parameters:
data- a given byte array.ignore- the number of bytes at the end of the byte array.- Returns:
- the generated CRC16 value.
-
CRC_16_byte
public static int CRC_16_byte(int prevValue, byte nextByte) Method which belongs to the calculation of 16-Bit CRC. -
getCRC_32
public static long getCRC_32(byte[] data) Method to determine the CRC-32 values for a given byte array. CRC start value is set to 0xFFFFFFFF and the generator polynom is 0x04C11DB7L according to IEEE 802.3- Parameters:
data- a byte array for which a CRC-32 value is requested.- Returns:
- the CRC-32 value over the given data.
-
getCRC_32
public static long getCRC_32(byte[] data, int omit) Method to determine the CRC-32 values for a given byte array. CRC start value is set to 0xFFFFFFFF and the generator polynom is 0x04C11DB7L according to IEEE 802.3- Parameters:
data- a byte array for which a CRC-32 value is requested.omit- the number of bytes at the end of the array not to include.- Returns:
- the CRC-32 value over the given data.
-
CRC_32_byte
public static long CRC_32_byte(long prevValue, byte nextByte) Processing of one byte to create a CRC-32 value for a byte array.- Parameters:
prevValue-nextByte-- Returns:
-