]> git.mxchange.org Git - core.git/blobdiff - contrib/chash/chash.php
Round it... ;-)
[core.git] / contrib / chash / chash.php
index 6b4594900be22bac434a6d73a8a525dd6806c807..83ddd2f320d26006c4d4a472a7e975ae09359c02 100644 (file)
@@ -212,7 +212,7 @@ function flushCheckPointFile ($nonce, $modulaHash) {
        $timer = microtime(TRUE);
 
        // Flush data
-       file_put_contents(CHECK_POINT, $GLOBALS['total_blocks'] . ':' . $GLOBALS['total_hashes'] . ':' . $GLOBALS['cycles'] . ':' . base64_encode($nonce) . ':' . $modulaHash . ':' . base64_encode(serialize($GLOBALS['found_hashes'])));
+       file_put_contents(CHECK_POINT, $GLOBALS['total_blocks'] . ':' . $GLOBALS['total_hashes'] . ':' . $GLOBALS['cycles'] . ':' . base64_encode($nonce) . ':' . $modulaHash . ':' . base64_encode(gzcompress(serialize($GLOBALS['found_hashes']))));
 
        // Set time
        $GLOBALS['time_flush'] = microtime(TRUE);
@@ -295,7 +295,7 @@ if (is_readable(CHECK_POINT)) {
        $GLOBALS['cycles']       = intval($data[2]);
        $nonce                   = base64_decode($data[3]);
        $modulaHash              = $data[4];
-       $GLOBALS['found_hashes'][$GLOBALS['total_blocks']] = unserialize(base64_decode($data[5]));
+       $GLOBALS['found_hashes'][$GLOBALS['total_blocks']] = unserialize(gzuncompress(base64_decode($data[5])));
 } else {
        // Create nonce (small)
        $nonce = 1 / mt_rand();
@@ -353,7 +353,7 @@ while (TRUE) {
                        // Only every second
                        if ($testTime >= 1) {
                                // Display hash rate
-                               print ('hashrate=' . $hashrate . ' hashes/sec,iterSecond=' . $iterSecond . ' iterations/sec' . PHP_EOL);
+                               print ('hashrate=' . round($hashrate) . ' hashes/sec,iterSecond=' . $iterSecond . ' iterations/sec' . PHP_EOL);
 
                                // Reset timer
                                $timeDisplay = microtime(TRUE);