Author: doogie Date: Thu May 3 21:13:21 2012 New Revision: 1333621 URL: http://svn.apache.org/viewvc?rev=1333621&view=rev Log: FEATURE: Improve warning when an oldFunnyHex hash is detected on a password.
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=1333621&r1=1333620&r2=1333621&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 Thu May 3 21:13:21 2012 @@ -52,7 +52,8 @@ public class HashCrypt { messagedigest.update(password.getBytes()); byte[] digestBytes = messagedigest.digest(); char[] digestChars = Hex.encodeHex(digestBytes); - if (hashed.equals(new String(digestChars))) { + String checkCrypted = new String(digestChars); + if (hashed.equals(checkCrypted)) { return true; } // This next block should be removed when all {prefix}oldFunnyHex are fixed. @@ -68,7 +69,7 @@ public class HashCrypt { k += 2; } if (hashed.equals(new String(digestChars))) { - Debug.logWarning("Warning: detected oldFunnyHex password prefixed with a hashType; this is not valid", module); + Debug.logWarning("Warning: detected oldFunnyHex password prefixed with a hashType; this is not valid, please update the value in the database with ({%s}%s)", module, hashType, checkCrypted); return true; } return false;