Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CRC {
- public CRC() {}
- public static byte CRC8(byte[] bytes){
- byte generator = (byte) 0x07;
- byte crc = 0;
- for(byte currByte : bytes){
- crc ^= currByte;
- for (int i = 0; i < 8; i++){
- if ((crc & 0x80) != 0){
- crc = (byte)((crc << 1) ^ generator);
- }
- else {
- crc <<= 1;
- }
- }
- }
- return crc;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement