Remove ByteUtils
[lgpl/argeo-commons.git] / org.argeo.util / src / org / argeo / util / DigestUtils.java
index e1a19160bd5a04afe23f834b6556e41bf53d91dd..38b4e7032a5cf35328b010771fe02a154f0c0d49 100644 (file)
@@ -1,7 +1,5 @@
 package org.argeo.util;
 
-import static org.argeo.util.BytesUtils.toHexString;
-
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -188,10 +186,17 @@ public class DigestUtils {
                }
        }
 
-       /** @deprecated Use {@link BytesUtils#toHexString(byte[])} instead */
-       @Deprecated
-       public static String encodeHexString(byte[] bytes) {
-               return BytesUtils.toHexString(bytes);
+       final private static char[] hexArray = "0123456789abcdef".toCharArray();
+
+       /** Converts a byte array to an hex String. */
+       public static String toHexString(byte[] bytes) {
+               char[] hexChars = new char[bytes.length * 2];
+               for (int j = 0; j < bytes.length; j++) {
+                       int v = bytes[j] & 0xFF;
+                       hexChars[j * 2] = hexArray[v >>> 4];
+                       hexChars[j * 2 + 1] = hexArray[v & 0x0F];
+               }
+               return new String(hexChars);
        }
 
 }