This is an automated email from the ASF dual-hosted git repository. jacopoc pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
commit b50db7e68d959cf200d2ada67307663029e2e7e2 Author: Jacopo Cappellato <[email protected]> AuthorDate: Thu Oct 1 10:55:25 2026 +0200 Remove unused and deprecated hash methods from HashCrypt class Thanks to Mridul Pathak (mridulpathak) for the review and suggestion. --- .../org/apache/ofbiz/base/crypto/HashCrypt.java | 45 ---------------------- 1 file changed, 45 deletions(-) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java b/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java index f425b2bf8f..6f12e2fa68 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java @@ -301,24 +301,6 @@ public class HashCrypt { } } - public static String digestHash64(String hashType, byte[] bytes) { - if (hashType == null) { - hashType = "SHA"; - } - try { - MessageDigest messagedigest = MessageDigest.getInstance(hashType); - messagedigest.update(bytes); - byte[] digestBytes = messagedigest.digest(); - - StringBuilder sb = new StringBuilder(); - sb.append("{").append(hashType).append("}"); - sb.append(Base64.encodeBase64URLSafeString(digestBytes).replace('+', '.')); - return sb.toString(); - } catch (NoSuchAlgorithmException e) { - throw new GeneralRuntimeException("Error while computing hash of type " + hashType, e); - } - } - /** * @deprecated use cryptPassword */ @@ -343,33 +325,6 @@ public class HashCrypt { return hashString.substring(hashString.indexOf('}') + 1); } - /** - * @deprecated use digestHashOldFunnyHex(hashType, str) - */ - @Deprecated - public static String getDigestHashOldFunnyHexEncode(String str, String hashType) { - return digestHashOldFunnyHex(hashType, str); - } - - public static String digestHashOldFunnyHex(String hashType, String str) { - if (UtilValidate.isEmpty(hashType)) { - hashType = "SHA"; - } - if (str == null) { - return null; - } - try { - MessageDigest messagedigest = MessageDigest.getInstance(hashType); - byte[] strBytes = str.getBytes(StandardCharsets.UTF_8); - - messagedigest.update(strBytes); - return oldFunnyHex(messagedigest.digest()); - } catch (Exception e) { - Debug.logError(e, "Error while computing hash of type " + hashType, MODULE); - } - return str; - } - // This next block should be removed when all {prefix}oldFunnyHex are fixed. private static String oldFunnyHex(byte[] bytes) { int k = 0;

