diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseProgressDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseProgressDialog.java index 37158168019ceeaf0dab156c39656b8808d2ea65..de6b84bdce9d8a7787ea9a2772c7689a0697fbf7 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseProgressDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseProgressDialog.java @@ -64,7 +64,7 @@ public class AddHashValuesToDatabaseProgressDialog extends javax.swing.JDialog { display(parent); this.hashes = new ArrayList<>(); this.invalidHashes = new ArrayList<>(); - this.md5Pattern = Pattern.compile("^[a-fA-F0-9]{32}$"); // NON-NLS + this.md5Pattern = Pattern.compile("^([a-fA-F0-9]{32})"); // NON-NLS this.parentRef = parent; this.hashDb = hashDb; this.text = text; @@ -162,9 +162,15 @@ private void getHashesFromTextArea(String text) { for (String hashEntry : linesInTextArea) { hashEntry = hashEntry.trim(); Matcher m = md5Pattern.matcher(hashEntry); - if (m.find()) { - // more information can be added to the HashEntry - sha-1, sha-512, comment - hashes.add(new HashEntry(null, m.group(0), null, null, null)); + if (m.find()) { + // Is there any text left on this line? If so, treat it as a comment. + final String comment = hashEntry.substring(m.end()).trim(); + if (comment.length() > 0) { + hashes.add(new HashEntry(null, m.group(0), null, null, comment)); + } else { + // more information can be added to the HashEntry - sha-1, sha-512, comment + hashes.add(new HashEntry(null, m.group(0), null, null, null)); + } } else { if (!hashEntry.isEmpty()) { invalidHashes.add(hashEntry);