aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-26 12:54:56 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-26 12:54:56 +1300
commitfbdd359d223579173b4e0076563df296f5492e3c (patch)
treefaacb0f61e284d17f942cb73d3a85f0dd3496d28 /src/org/traccar
parentd938e1e4d8d54fec6aab26246b6b804d34addf66 (diff)
downloadtraccar-server-fbdd359d223579173b4e0076563df296f5492e3c.tar.gz
traccar-server-fbdd359d223579173b4e0076563df296f5492e3c.tar.bz2
traccar-server-fbdd359d223579173b4e0076563df296f5492e3c.zip
Rename hex conversion methods
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/helper/ChannelBufferTools.java4
-rw-r--r--src/org/traccar/helper/Hashing.java8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/org/traccar/helper/ChannelBufferTools.java b/src/org/traccar/helper/ChannelBufferTools.java
index d8d74b6ea..99da43b54 100644
--- a/src/org/traccar/helper/ChannelBufferTools.java
+++ b/src/org/traccar/helper/ChannelBufferTools.java
@@ -89,7 +89,7 @@ public final class ChannelBufferTools {
return value;
}
- public static byte[] convertHexString(String in) {
+ public static byte[] hexToBytes(String in) {
int count = in.length() / 2;
byte[] out = new byte[count];
for (int i = 0; i < count; i++) {
@@ -98,7 +98,7 @@ public final class ChannelBufferTools {
return out;
}
- public static String convertByteArray(byte[] in) {
+ public static String bytesToHex(byte[] in) {
StringBuilder out = new StringBuilder();
Formatter formatter = new Formatter(out);
for (byte b : in) {
diff --git a/src/org/traccar/helper/Hashing.java b/src/org/traccar/helper/Hashing.java
index 1f01d9102..cdc5c7ae5 100644
--- a/src/org/traccar/helper/Hashing.java
+++ b/src/org/traccar/helper/Hashing.java
@@ -65,13 +65,13 @@ public final class Hashing {
RANDOM.nextBytes(salt);
byte[] hash = function(password.toCharArray(), salt);
return new HashingResult(
- ChannelBufferTools.convertByteArray(hash),
- ChannelBufferTools.convertByteArray(salt));
+ ChannelBufferTools.bytesToHex(hash),
+ ChannelBufferTools.bytesToHex(salt));
}
public static boolean validatePassword(String password, String hashHex, String saltHex) {
- byte[] hash = ChannelBufferTools.convertHexString(hashHex);
- byte[] salt = ChannelBufferTools.convertHexString(saltHex);
+ byte[] hash = ChannelBufferTools.hexToBytes(hashHex);
+ byte[] salt = ChannelBufferTools.hexToBytes(saltHex);
return slowEquals(hash, function(password.toCharArray(), salt));
}