From 0ac9ad7fc62b53e92011d523f6823f87399ba294 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 28 Apr 2014 17:04:51 +0200 Subject: [PATCH] Use ZLIB compression. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- contrib/chash/chash.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/chash/chash.php b/contrib/chash/chash.php index 6b459490..b3bd3e63 100644 --- a/contrib/chash/chash.php +++ b/contrib/chash/chash.php @@ -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(); -- 2.30.2