mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-01 19:15:52 +01:00
added scm-web-compressor maven plugin
This commit is contained in:
@@ -29,11 +29,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.security;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.util.AssertUtil;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -132,22 +135,7 @@ public class MessageDigestEncryptionHandler implements EncryptionHandler
|
||||
messageDigest.reset();
|
||||
messageDigest.update(value.getBytes());
|
||||
|
||||
byte hashCode[] = messageDigest.digest();
|
||||
StringBuilder hashString = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < hashCode.length; i++)
|
||||
{
|
||||
int x = hashCode[i] & 0xff;
|
||||
|
||||
if (x < 16)
|
||||
{
|
||||
hashString.append('0');
|
||||
}
|
||||
|
||||
hashString.append(Integer.toString(x, 16));
|
||||
}
|
||||
|
||||
return hashString.toString();
|
||||
return Util.toString(messageDigest.digest());
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
@@ -94,9 +96,7 @@ public class ChecksumUtil
|
||||
}
|
||||
}
|
||||
|
||||
byte[] b = digest.digest();
|
||||
|
||||
return toHexString(b);
|
||||
return Util.toString(digest.digest());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,26 +114,6 @@ public class ChecksumUtil
|
||||
return createChecksum(new FileInputStream(file));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param byteArray
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static String toHexString(byte[] byteArray)
|
||||
{
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
|
||||
for (byte b : byteArray)
|
||||
{
|
||||
buffer.append(Integer.toHexString(b));
|
||||
}
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
@@ -219,4 +221,33 @@ public class Util
|
||||
{
|
||||
return (array != null) && (array.length > 0);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param byteValue
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String toString(byte[] byteValue)
|
||||
{
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < byteValue.length; i++)
|
||||
{
|
||||
int x = byteValue[i] & 0xff;
|
||||
|
||||
if (x < 16)
|
||||
{
|
||||
buffer.append('0');
|
||||
}
|
||||
|
||||
buffer.append(Integer.toString(x, 16));
|
||||
}
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user