diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-02-02 15:36:54 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-02-02 15:36:54 -0800 |
commit | ee1dbcf048a922b6023b0714989b454b7dfe9587 (patch) | |
tree | 96e3d5f379e6151a12a7f608143faf088c37076b /src/main/java/org/traccar/helper | |
parent | 75e5eded6c877577044e9db22cae255cac8d04a1 (diff) | |
download | trackermap-server-ee1dbcf048a922b6023b0714989b454b7dfe9587.tar.gz trackermap-server-ee1dbcf048a922b6023b0714989b454b7dfe9587.tar.bz2 trackermap-server-ee1dbcf048a922b6023b0714989b454b7dfe9587.zip |
Fix merge issues
Diffstat (limited to 'src/main/java/org/traccar/helper')
-rw-r--r-- | src/main/java/org/traccar/helper/Checksum.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/helper/Checksum.java b/src/main/java/org/traccar/helper/Checksum.java index adfa697c5..d41dc2992 100644 --- a/src/main/java/org/traccar/helper/Checksum.java +++ b/src/main/java/org/traccar/helper/Checksum.java @@ -168,6 +168,14 @@ public final class Checksum { return checksum; } + public static int modulo256(ByteBuffer buf) { + int checksum = 0; + while (buf.hasRemaining()) { + checksum = (checksum + buf.get()) & 0xFF; + } + return checksum; + } + public static String sum(String msg) { byte checksum = 0; for (byte b : msg.getBytes(StandardCharsets.US_ASCII)) { |