diff options
Diffstat (limited to 'src/org/traccar/model')
-rw-r--r-- | src/org/traccar/model/User.java | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/src/org/traccar/model/User.java b/src/org/traccar/model/User.java index 9186e66c5..410bc4d74 100644 --- a/src/org/traccar/model/User.java +++ b/src/org/traccar/model/User.java @@ -15,9 +15,7 @@ */ package org.traccar.model; -import java.io.UnsupportedEncodingException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; +import org.traccar.helper.Hashing; public class User implements Factory { @@ -40,7 +38,7 @@ public class User implements Factory { private byte[] password; public byte[] getPassword() { return password; } - public void setPassword(String password) { this.password = sha256(password); } + public void setPassword(String password) { this.password = Hashing.sha256(password); } private boolean readonly; @@ -61,19 +59,4 @@ public class User implements Factory { private double longitude; private int zoom; - - - public static byte[] sha256(String text) { - try { - MessageDigest md = MessageDigest.getInstance("SHA-256"); - - md.update(text.getBytes("UTF-8")); - byte[] digest = md.digest(); - return digest; - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } - } } |