diff options
author | Vitaly Litvak <vitavaque@gmail.com> | 2016-10-02 08:17:43 +0300 |
---|---|---|
committer | Vitaly Litvak <vitavaque@gmail.com> | 2016-10-02 08:17:43 +0300 |
commit | 9cc1cbd2b21afcd40091069d2f0a58565db18c15 (patch) | |
tree | 5393357116c24bc217a604e31e4a5fe1730b41c7 /src/org/traccar/helper | |
parent | b5a09475b90b044cf0b5b0f64d8709dd7e92c460 (diff) | |
download | trackermap-server-9cc1cbd2b21afcd40091069d2f0a58565db18c15.tar.gz trackermap-server-9cc1cbd2b21afcd40091069d2f0a58565db18c15.tar.bz2 trackermap-server-9cc1cbd2b21afcd40091069d2f0a58565db18c15.zip |
Moved 'xor' checksum method to the utility class.
Diffstat (limited to 'src/org/traccar/helper')
-rw-r--r-- | src/org/traccar/helper/Checksum.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/org/traccar/helper/Checksum.java b/src/org/traccar/helper/Checksum.java index 2a4b1191d..dde174545 100644 --- a/src/org/traccar/helper/Checksum.java +++ b/src/org/traccar/helper/Checksum.java @@ -194,6 +194,15 @@ public final class Checksum { return checksum; } + public static int xor(String string) { + byte[] bytes = string.getBytes(StandardCharsets.US_ASCII); + byte sum = 0; + for (byte b : bytes) { + sum ^= b; + } + return sum; + } + public static String nmea(String msg) { int checksum = 0; for (byte b : msg.getBytes(StandardCharsets.US_ASCII)) { |