ppkarwasz commented on code in PR #147:
URL: https://github.com/apache/maven-shared-jar/pull/147#discussion_r3709381848


##########
src/main/java/org/apache/maven/shared/jar/identification/hash/JarBytecodeHashAnalyzer.java:
##########
@@ -49,13 +51,19 @@ public String computeHash(JarAnalyzer jarAnalyzer) {
             List<JarEntry> entries = jarAnalyzer.getClassEntries();
 
             try {
+                MessageDigest sha1 = MessageDigest.getInstance("SHA-1");

Review Comment:
   _Nitpick_:
   
   ```suggestion
                   MessageDigest sha1 = DigestUtils.getSha1Digest();
   ```



##########
src/main/java/org/apache/maven/shared/jar/identification/hash/JarBytecodeHashAnalyzer.java:
##########
@@ -49,13 +51,19 @@ public String computeHash(JarAnalyzer jarAnalyzer) {
             List<JarEntry> entries = jarAnalyzer.getClassEntries();
 
             try {
+                MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
+                byte[] buffer = new byte[8192];
                 for (JarEntry entry : entries) {
                     try (InputStream is = 
jarAnalyzer.getEntryInputStream(entry)) {
-                        result = DigestUtils.sha1Hex(is);
+                        int read;
+                        while ((read = is.read(buffer)) != -1) {
+                            sha1.update(buffer, 0, read);
+                        }

Review Comment:
   Could be replaced with:
   
   ```suggestion
                           DigestUtils.updateDigest(is);
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to