From 05c65d3abdcfd26957bbe473083f207c730da12e Mon Sep 17 00:00:00 2001 From: davidrozen76 <40019842+davidrozen76@users.noreply.github.com> Date: Sun, 21 Jan 2024 16:50:51 +0200 Subject: [PATCH 1/3] Add support for double salted hashes These change render the possibility for one to run a task on hashes which are doubly-salted (e.g. hash mode 3730). --- src/getFound.php | 5 ++++- src/getHashlist.php | 8 ++++++-- src/inc/api/APISendProgress.class.php | 4 ++++ src/inc/utils/TaskUtils.class.php | 5 ++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/getFound.php b/src/getFound.php index 51b6242f7..a9bd4f455 100644 --- a/src/getFound.php +++ b/src/getFound.php @@ -58,7 +58,10 @@ foreach ($current as $entry) { $output .= $entry->getHash(); if (strlen($entry->getSalt()) > 0) { - $output .= "\t" . $entry->getSalt(); + $salts = explode($hashlist->getSaltSeparator(), $entry->getSalt()); // Double salt + foreach ($salts as $salt) { + $output .= "\t" . $salt; + } } $output .= "\tFF" . $lineDelimiter; } diff --git a/src/getHashlist.php b/src/getHashlist.php index ea35c8802..7724e4924 100644 --- a/src/getHashlist.php +++ b/src/getHashlist.php @@ -69,10 +69,14 @@ $output = ""; $count += sizeof($current); - foreach ($current as $entry) { + + foreach ($current as $entry) { $output .= $entry->getHash(); if (strlen($entry->getSalt()) > 0) { - $output .= "\t" . $entry->getSalt(); + $salts = explode($hashlist->getSaltSeparator(), $entry->getSalt()); // Double salt + foreach ($salts as $salt) { + $output .= "\t" . $salt; + } } $output .= $lineDelimiter; } diff --git a/src/inc/api/APISendProgress.class.php b/src/inc/api/APISendProgress.class.php index fdcf762b5..a47a081d7 100644 --- a/src/inc/api/APISendProgress.class.php +++ b/src/inc/api/APISendProgress.class.php @@ -236,6 +236,10 @@ public function execute($QUERY = array()) { $plain = $splitLine[2]; // if hash is salted $crackPos = $splitLine[4]; } + else if (sizeof($splitLine) == 6) { // Doulbe salt + $plain = $splitLine[3]; // if hash is salted + $crackPos = $splitLine[5]; + } else { $plain = $splitLine[1]; $crackPos = $splitLine[3]; diff --git a/src/inc/utils/TaskUtils.class.php b/src/inc/utils/TaskUtils.class.php index c06cacc50..ff723fc34 100644 --- a/src/inc/utils/TaskUtils.class.php +++ b/src/inc/utils/TaskUtils.class.php @@ -1323,7 +1323,10 @@ public static function getCrackedHashes($taskId, $user) { "crackpos" => $entry->getCrackPos() ]; if (strlen($entry->getSalt()) > 0) { - $arr["hash"] .= $hashlist->getSaltSeparator() . $entry->getSalt(); + $salts = explode($hashlist->getSaltSeparator(), $entry->getSalt()); // Double salt + foreach ($salts as $salt) { + $arr["hash"] .= $hashlist->getSaltSeparator() . $salt; + } } $hashes[] = $arr; } From da885ca28a9fd2bb4e0b88e92037327ccdcf3aa2 Mon Sep 17 00:00:00 2001 From: davidrozen76 <40019842+davidrozen76@users.noreply.github.com> Date: Sun, 21 Jan 2024 16:52:50 +0200 Subject: [PATCH 2/3] Update getHashlist.php Fix indentation --- src/getHashlist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/getHashlist.php b/src/getHashlist.php index 7724e4924..f6b74ae45 100644 --- a/src/getHashlist.php +++ b/src/getHashlist.php @@ -70,7 +70,7 @@ $output = ""; $count += sizeof($current); - foreach ($current as $entry) { + foreach ($current as $entry) { $output .= $entry->getHash(); if (strlen($entry->getSalt()) > 0) { $salts = explode($hashlist->getSaltSeparator(), $entry->getSalt()); // Double salt From b86d94e1d274cd90f15ef676b66f833bba7b98fa Mon Sep 17 00:00:00 2001 From: davidrozen76 <40019842+davidrozen76@users.noreply.github.com> Date: Sun, 21 Jan 2024 16:53:47 +0200 Subject: [PATCH 3/3] Update getHashlist.php Fix indentation --- src/getHashlist.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/getHashlist.php b/src/getHashlist.php index f6b74ae45..715164b3d 100644 --- a/src/getHashlist.php +++ b/src/getHashlist.php @@ -74,9 +74,9 @@ $output .= $entry->getHash(); if (strlen($entry->getSalt()) > 0) { $salts = explode($hashlist->getSaltSeparator(), $entry->getSalt()); // Double salt - foreach ($salts as $salt) { - $output .= "\t" . $salt; - } + foreach ($salts as $salt) { + $output .= "\t" . $salt; + } } $output .= $lineDelimiter; }