aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/helper')
-rw-r--r--src/org/traccar/helper/Checksum.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/org/traccar/helper/Checksum.java b/src/org/traccar/helper/Checksum.java
index 43ba6a689..44cef9635 100644
--- a/src/org/traccar/helper/Checksum.java
+++ b/src/org/traccar/helper/Checksum.java
@@ -243,4 +243,12 @@ public final class Checksum {
return (10 - (checksum % 10)) % 10;
}
+ public static int modulo256(byte[] bytes) {
+ int sum = 0;
+ for (byte b : bytes) {
+ sum = (sum + b) & 0xFF;
+ }
+ return sum;
+ }
+
}