Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/inc/utils/HashlistUtils.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,15 @@ public static function getCrackedHashes($hashlistId, $user) {
}
$hashes[] = $arr;
}
$entries_binary = Factory::getHashBinaryFactory()->filter([Factory::FILTER => [$qF1, $qF2]]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing 2 queries, it is better to check in the hashlist whether it is a binary hashlist or a normal text hashlist. What you could do is the following:

if ($hashlist->getFormat === 0) {
$entries = Factory::getHashFactory()->filter([Factory::FILTER => [$qF1, $qF2]]);
} else {
$entries = Factory::getBinaryHashFactory()->filter([Factory::FILTER => [$qF1, $qF2]]);
}

And then you could build the hashes according to their type. In the HashlistUtils line 700 to line 714 you can see how hashes of different types are built, you can use that as example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks for pointing that out. I have implemented the recommended change

foreach ($entries_binary as $entry) {
$arr = [
"hash" => $entry->getHash(),
"plain" => $entry->getPlaintext(),
"crackpos" => $entry->getCrackPos()
];
$hashes[] = $arr;
}
return $hashes;
}

Expand Down