aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper/Hashing.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-13 23:11:23 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-13 23:11:23 +1300
commit398b705820109c1103d915a2fec81fcf70b032cf (patch)
tree659a0483eda19f9c91855197b70fd2a0bfb82a60 /src/org/traccar/helper/Hashing.java
parent2da5669f8bd3f734fa37626c892aebdff7268613 (diff)
downloadtrackermap-server-398b705820109c1103d915a2fec81fcf70b032cf.tar.gz
trackermap-server-398b705820109c1103d915a2fec81fcf70b032cf.tar.bz2
trackermap-server-398b705820109c1103d915a2fec81fcf70b032cf.zip
Fix some check style issues
Diffstat (limited to 'src/org/traccar/helper/Hashing.java')
-rw-r--r--src/org/traccar/helper/Hashing.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/org/traccar/helper/Hashing.java b/src/org/traccar/helper/Hashing.java
index beb674b00..1f01d9102 100644
--- a/src/org/traccar/helper/Hashing.java
+++ b/src/org/traccar/helper/Hashing.java
@@ -15,12 +15,12 @@
*/
package org.traccar.helper;
-import javax.crypto.SecretKeyFactory;
-import javax.crypto.spec.PBEKeySpec;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.PBEKeySpec;
-public class Hashing {
+public final class Hashing {
public static final int ITERATIONS = 1000;
public static final int SALT_SIZE = 24;
@@ -45,6 +45,9 @@ public class Hashing {
}
}
+ private Hashing() {
+ }
+
private static byte[] function(char[] password, byte[] salt) {
try {
PBEKeySpec spec = new PBEKeySpec(password, salt, ITERATIONS, HASH_SIZE * Byte.SIZE);
@@ -55,10 +58,11 @@ public class Hashing {
}
}
- private static final SecureRandom random = new SecureRandom();
+ private static final SecureRandom RANDOM = new SecureRandom();
public static HashingResult createHash(String password) {
- byte[] salt = new byte[SALT_SIZE]; random.nextBytes(salt);
+ byte[] salt = new byte[SALT_SIZE];
+ RANDOM.nextBytes(salt);
byte[] hash = function(password.toCharArray(), salt);
return new HashingResult(
ChannelBufferTools.convertByteArray(hash),