diff options
author | Irving Gonzalez <ialexis93@gmail.com> | 2015-06-09 21:55:35 -0600 |
---|---|---|
committer | Irving Gonzalez <ialexis93@gmail.com> | 2015-06-09 21:55:35 -0600 |
commit | d8f950b6b90f3ce144fd2ae78184844ffbacc9b7 (patch) | |
tree | fc9642ed3159dd16ebd1c5448233b251b091921c /src/org/traccar/helper/Hashing.java | |
parent | 42eaa18d37edb09df6cb39174f1da1358e3280e7 (diff) | |
parent | ee087f587a96700d91e407d434e94d1616c18368 (diff) | |
download | trackermap-server-d8f950b6b90f3ce144fd2ae78184844ffbacc9b7.tar.gz trackermap-server-d8f950b6b90f3ce144fd2ae78184844ffbacc9b7.tar.bz2 trackermap-server-d8f950b6b90f3ce144fd2ae78184844ffbacc9b7.zip |
Merge branch 'master' of https://github.com/tananaev/traccar
Conflicts:
.gitignore
Diffstat (limited to 'src/org/traccar/helper/Hashing.java')
-rw-r--r-- | src/org/traccar/helper/Hashing.java | 20 |
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); + } + } + +} |