From 57adde2ad243a28700a9e1352e6c9eafaa90cfc4 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 13 Mar 2015 04:10:55 +0100 Subject: [PATCH] Fixed loading of chash.pos (wrong indexes) + added cast to float for nonce. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- contrib/chash/chash.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/chash/chash.php b/contrib/chash/chash.php index acba7c98..408b4660 100644 --- a/contrib/chash/chash.php +++ b/contrib/chash/chash.php @@ -218,7 +218,7 @@ function flushCheckPointFile ($hash) { $GLOBALS['total_found'] . ':' . $GLOBALS['total_restarts'] . ':' . $GLOBALS['hash_cycles'] . ':' . - base64_encode($GLOBALS['nonce']) . ':' . + base64_encode((float) $GLOBALS['nonce']) . ':' . $hash . ':' . $GLOBALS['root_hash'] . ':' . base64_encode(gzcompress(serialize($GLOBALS['found_hashes']))) @@ -243,7 +243,7 @@ function addFoundHash ($hash) { 'modula_hash' => $GLOBALS['modula_hash'], 'genesis_hash' => $GLOBALS['genesis_hash'], 'root_hash' => $GLOBALS['root_hash'], - 'nonce' => $GLOBALS['nonce'], + 'nonce' => (float) $GLOBALS['nonce'], 'iter' => $GLOBALS['iteration'], 'hashes_block' => $GLOBALS['hashes_block'], 'hash_cycles' => $GLOBALS['hash_cycles'], @@ -364,12 +364,12 @@ if (is_readable(CHECK_POINT)) { $GLOBALS['total_found'] = $data[3]; $GLOBALS['total_restarts'] = $data[4]; $GLOBALS['hash_cycles'] = intval($data[5]); - $GLOBALS['nonce'] = base64_decode($data[7]); + $GLOBALS['nonce'] = (float) base64_decode($data[6]); $GLOBALS['root_hash'] = $data[8]; $GLOBALS['found_hashes'] = unserialize(gzuncompress(base64_decode($data[9]))); // Set modula hash - setModulaHash($data[6]); + setModulaHash($data[7]); } else { // Create nonce (small) initNonce(); -- 2.39.5