Author: doogie
Date: Sun Apr 18 18:03:59 2010
New Revision: 935383
URL:
http://svn.apache.org/viewvc?rev=935383&view=revLog:
Don't create a temporary string to hold the digestChars.
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/crypto/HashCrypt.java
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/crypto/HashCrypt.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/crypto/HashCrypt.java?rev=935383&r1=935382&r2=935383&view=diff==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/crypto/HashCrypt.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/crypto/HashCrypt.java Sun Apr 18 18:03:59 2010
@@ -48,7 +48,10 @@ public class HashCrypt {
byte[] digestBytes = messagedigest.digest();
char[] digestChars = Hex.encodeHex(digestBytes);
- return "{" + hashType + "}" + new String(digestChars, 0, digestChars.length);
+ StringBuilder sb = new StringBuilder();
+ sb.append("{").append(hashType).append("}");
+ sb.append(digestChars, 0, digestChars.length);
+ return sb.toString();
} catch (Exception e) {
throw new GeneralRuntimeException("Error while computing hash of type " + hashType, e);
}
@@ -66,7 +69,10 @@ public class HashCrypt {
messagedigest.update(codeBytes);
byte digestBytes[] = messagedigest.digest();
char[] digestChars = Hex.encodeHex(digestBytes);;
- return "{" + hashType + "}" + new String(digestChars, 0, digestChars.length);
+ StringBuilder sb = new StringBuilder();
+ sb.append("{").append(hashType).append("}");
+ sb.append(digestChars, 0, digestChars.length);
+ return sb.toString();
} catch (Exception e) {
throw new GeneralRuntimeException("Error while computing hash of type " + hashType, e);
}