X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=c6739d34edad671e46c55fc5831db94c6c225672;hp=b56975ac61db9bcb3363abeb9040fef5b690466b;hb=60403e95910ee466e0ef685b068facb88237721f;hpb=f51be78aa682f22b29fcfcfcd4331d6b3b47a552 diff --git a/inc/functions.php b/inc/functions.php index b56975ac61..c6739d34ed 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2236,22 +2236,22 @@ function encodeHashForCookie ($passHash) { $ret = $passHash; // Is a secret key and master salt already initialized? - //* DEBUG: */ outputHtml(__FUNCTION__.':'.intval(isExtensionInstalled('sql_patches')).'/'.intval(isConfigEntrySet('_PRIME')).'/'.intval(isConfigEntrySet('secret_key')).'/'.intval(isConfigEntrySet('master_salt')).'
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, intval(isExtensionInstalled('sql_patches')) . '/' . intval(isConfigEntrySet('_PRIME')) . '/' . intval(isConfigEntrySet('secret_key')) . '/' . intval(isConfigEntrySet('master_salt'))); if ((isExtensionInstalled('sql_patches')) && (isConfigEntrySet('_PRIME')) && (isConfigEntrySet('secret_key')) && (isConfigEntrySet('master_salt'))) { // Only calculate when the secret key is generated - //* DEBUG: */ outputHtml(__FUNCTION__.':'.strlen($passHash).'/'.strlen(getConfig('secret_key')).'
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, strlen($passHash) . '/' . strlen(getConfig('secret_key'))); if ((strlen($passHash) != 49) || (strlen(getConfig('secret_key')) != 40)) { // Both keys must have same length so return unencrypted - logDebugMessage(__FUNCTION__, __LINE__, strlen($passHash).'!=49/'.strlen(getConfig('secret_key')).'!=40'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, strlen($passHash) . '!=49/' . strlen(getConfig('secret_key')) . '!=40'); return $ret; } // END - if $newHash = ''; $start = 9; - //* DEBUG: */ outputHtml('passHash=' . $passHash . '(' . strlen($passHash) . ')
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'passHash=' . $passHash . '(' . strlen($passHash) . ')'); for ($idx = 0; $idx < 20; $idx++) { $part1 = hexdec(substr($passHash, ($idx * 2) + (strlen($passHash) - strlen(getConfig('secret_key'))), 2)); $part2 = hexdec(substr(getConfig('secret_key'), $start, 2)); - //* DEBUG: */ outputHtml('part1='.$part1.'/part2='.$part2.'
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'part1=' . $part1 . '/part2=' . $part2); $mod = dechex($idx); if ($part1 > $part2) { $mod = dechex(sqrt(($part1 - $part2) * getConfig('_PRIME') / pi())); @@ -2259,19 +2259,19 @@ function encodeHashForCookie ($passHash) { $mod = dechex(sqrt(($part2 - $part1) * getConfig('_PRIME') / pi())); } $mod = substr($mod, 0, 2); - //* DEBUG: */ outputHtml('part1='.$part1.'/part2='.$part2.'/mod=' . $mod . '('.strlen($mod).')
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'part1=' . $part1 . '/part2=' . $part2 . '/mod=' . $mod . '(' . strlen($mod) . ')'); $mod = str_repeat(0, (2 - strlen($mod))) . $mod; - //* DEBUG: */ outputHtml('mod(' . ($idx * 2) . ')=' . $mod . '*
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'mod(' . ($idx * 2) . ')=' . $mod . '*'); $start += 2; $newHash .= $mod; } // END - for - //* DEBUG: */ outputHtml($passHash . '
' . $newHash . ' (' . strlen($newHash) . ')
'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $passHash . ',' . $newHash . ' (' . strlen($newHash) . ')'); $ret = generateHash($newHash, getConfig('master_salt')); - //* DEBUG: */ outputHtml('ret=' . $ret . '
'); } // END - if // Return result + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret=' . $ret . ''); return $ret; }