aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper/Hashing.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-06-10 15:45:55 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-06-10 15:45:55 +1200
commitee087f587a96700d91e407d434e94d1616c18368 (patch)
treefc9642ed3159dd16ebd1c5448233b251b091921c /src/org/traccar/helper/Hashing.java
parentee4c07115d3bc3e58b92310f54bee7bd616ec669 (diff)
parent96a2d024658746f50628727f7255c4e19ecdb1b4 (diff)
downloadtrackermap-server-ee087f587a96700d91e407d434e94d1616c18368.tar.gz
trackermap-server-ee087f587a96700d91e407d434e94d1616c18368.tar.bz2
trackermap-server-ee087f587a96700d91e407d434e94d1616c18368.zip
Merge pull request #1240 from demianalonso/master
Move SQL queries to the config file
Diffstat (limited to 'src/org/traccar/helper/Hashing.java')
-rw-r--r--src/org/traccar/helper/Hashing.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/org/traccar/helper/Hashing.java b/src/org/traccar/helper/Hashing.java
new file mode 100644
index 000000000..7e7579ede
--- /dev/null
+++ b/src/org/traccar/helper/Hashing.java
@@ -0,0 +1,20 @@
+package org.traccar.helper;
+
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class Hashing {
+
+ public static byte[] sha256(String text) {
+ try {
+ MessageDigest md = MessageDigest.getInstance("SHA-256");
+ md.update(text.getBytes(StandardCharsets.UTF_8));
+
+ return md.digest();
+ } catch (NoSuchAlgorithmException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}