diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-10 19:21:31 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-10 19:21:31 +1200 |
commit | ae56bc9e1f212bf96c3573b43fb8b11983bbb3e1 (patch) | |
tree | 5c7d8a5c668bffe604a1c35594a170984b944f8b /src/org | |
parent | 77a55f2f48ab6ea32299e16c4a2da21d4872af9e (diff) | |
download | traccar-server-ae56bc9e1f212bf96c3573b43fb8b11983bbb3e1.tar.gz traccar-server-ae56bc9e1f212bf96c3573b43fb8b11983bbb3e1.tar.bz2 traccar-server-ae56bc9e1f212bf96c3573b43fb8b11983bbb3e1.zip |
Fix Hashing Java 6 support
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/helper/Hashing.java | 9 |
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); } } |