Sign in

王通 / gb32960_server · Files

GitLab

  • Go to dashboard
  • Project
  • Activity
  • Files
  • Commits
  • Builds 0
  • Network
  • Graphs
  • Milestones
  • Issues 0
  • Merge Requests 0
  • Labels
  • Wiki
  • gb32960_server
  • ..
  • util
  • CrcUtil.java
  • Init
      27f727e0
    王通 authored
    2024-10-25 09:02:26 +0800  
    Browse Code »
CrcUtil.java 373 Bytes
Edit Raw Blame History
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
package com.bsth.util;

/**
 * @author Hill
 */
public class CrcUtil {

    public static byte bbc(byte[] bytes, int start, int end) {
        if (start > end) {
            throw new IllegalArgumentException("无效的参数");
        }

        byte crc = 0;
        for (int i = start;i <= end;i++) {
            crc ^= bytes[i];
        }

        return crc;
    }
}