Class CRC8

java.lang.Object
org.miaixz.bus.core.io.check.CRC8
All Implemented Interfaces:
Serializable, Checksum

public class CRC8 extends Object implements Checksum, Serializable
CRC8 循环冗余校验码(Cyclic Redundancy Check)实现 代码来自:https://github.com/BBSc0der
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Constructor Details

    • CRC8

      public CRC8(int polynomial, short init)
      构造
      Parameters:
      polynomial - Polynomial, typically one of the POLYNOMIAL_* constants.
      init - Initial value, typically either 0xff or zero.
  • Method Details

    • update

      public void update(byte[] buffer, int offset, int len)
      Specified by:
      update in interface Checksum
    • update

      public void update(byte[] buffer)
      Updates the current check with the specified array of bytes. Equivalent to calling update(buffer, 0, buffer.length).
      Specified by:
      update in interface Checksum
      Parameters:
      buffer - the byte array to update the check with
    • update

      public void update(int b)
      Specified by:
      update in interface Checksum
    • getValue

      public long getValue()
      Specified by:
      getValue in interface Checksum
    • reset

      public void reset()
      Specified by:
      reset in interface Checksum