You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/02/09 15:04:57 UTC

[GitHub] [nifi] Lehel44 commented on a change in pull request #4788: NIFI-8132 Replaced framework uses of MD5 with SHA-256

Lehel44 commented on a change in pull request #4788:
URL: https://github.com/apache/nifi/pull/4788#discussion_r572961951



##########
File path: nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/classloader/ClassLoaderUtils.java
##########
@@ -143,19 +143,13 @@ public static String generateAdditionalUrlsFingerprint(Set<URL> urls) {
 
         //Sorting so that the order is maintained for generating the fingerprint
         Collections.sort(listOfUrls);
-        try {
-            MessageDigest md = MessageDigest.getInstance("MD5");
-            listOfUrls.forEach(url -> {
-                urlBuffer.append(url).append("-").append(getLastModified(url)).append(";");
-            });
-            byte[] bytesOfAdditionalUrls = urlBuffer.toString().getBytes(StandardCharsets.UTF_8);
-            byte[] bytesOfDigest = md.digest(bytesOfAdditionalUrls);
-
-            return DatatypeConverter.printHexBinary(bytesOfDigest);
-        } catch (NoSuchAlgorithmException e) {
-            LOGGER.error("Unable to generate fingerprint for the provided additional resources {}", new Object[]{urls, e});
-            return null;
-        }
+        listOfUrls.forEach(url -> {

Review comment:
       Hi,
   Optinally, this statement clambda an be replaced with an expression lambda. Also, do you think changing urlBuffer type from StringBuffer to StringBuilder as it doesn't need to be synchronised, would have any performance improvement effect?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org