aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/helper/Hashing.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/org/traccar/helper/Hashing.java b/src/org/traccar/helper/Hashing.java
index 7e7579ede..3f3e30e6e 100644
--- a/src/org/traccar/helper/Hashing.java
+++ b/src/org/traccar/helper/Hashing.java
@@ -1,19 +1,20 @@
package org.traccar.helper;
-import java.nio.charset.StandardCharsets;
+import java.io.UnsupportedEncodingException;
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));
-
+ md.update(text.getBytes("UTF-8"));
return md.digest();
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
}
}