68 if (!class_exists(
'nanoSha2')) {
74 function nanoSha2($toUpper =
false)
77 $this->toUpper = is_bool($toUpper)
79 : ((defined(
'_NANO_SHA2_UPPER')) ?
true :
false);
81 $tmpInt = (int)4294967295;
82 $this->platform = ($tmpInt > 0) ? 64 : 32;
85 function char_pad($str)
89 $l = strlen($tmpStr) * 8;
93 $k = (512 - ((
$l + 8 + 64) % 512)) / 8;
96 for ($x = 0; $x < $k; $x++) {
100 $tmpStr .= chr(((
$l >> 24) &0xFF));
101 $tmpStr .= chr(((
$l >> 16) &0xFF));
102 $tmpStr .= chr(((
$l >> 8) &0xFF));
103 $tmpStr .= chr((
$l &0xFF));
108 function addmod2n($x, $y, $n = 4294967296)
114 $x = (float)$x + $mask;
119 $y = (float)$y + $mask;
147 $mask = $mask >> ($n-1);
148 return ($x >> $n) | $mask;
151 return (
int)$x >> (int)$n;
154 function ROTR($x, $n)
156 return (
int)(($this->SHR($x, $n) | ($x << (32 - $n)) &0xFFFFFFFF));
158 function Ch($x, $y, $z)
160 return ($x &$y) ^ ((~$x) &$z);
162 function Maj($x, $y, $z)
164 return ($x &$y) ^ ($x &$z) ^ ($y &$z);
168 return (
int) ($this->ROTR($x, 2) ^ $this->ROTR($x, 13) ^ $this->ROTR($x, 22));
172 return (
int) ($this->ROTR($x, 6) ^ $this->ROTR($x, 11) ^ $this->ROTR($x, 25));
176 return (
int) ($this->ROTR($x, 7) ^ $this->ROTR($x, 18) ^ $this->SHR($x, 3));
180 return (
int) ($this->ROTR($x, 17) ^ $this->ROTR($x, 19) ^ $this->SHR($x, 10));
187 function int_split($input)
200 $int_build = (ord($input[
$i]) << 24);
201 $int_build += (ord($input[
$i + 1]) << 16);
202 $int_build += (ord($input[
$i + 2]) << 8);
203 $int_build += (ord($input[
$i + 3]));
218 function hash($str, $ig_func =
false)
224 if ($ig_func ==
false) {
225 if (function_exists(
'hash') && version_compare(PHP_VERSION,
'5.1.2',
'>=')) {
226 return hash(
"sha256", $str,
false);
227 }
elseif (function_exists(
'mhash') && defined(
'MHASH_SHA256')) {
228 return base64_encode(bin2hex(mhash(MHASH_SHA256, $str)));
238 $K = array((
int)0x428a2f98, (
int)0x71374491, (
int)0xb5c0fbcf,
239 (
int)0xe9b5dba5, (
int)0x3956c25b, (
int)0x59f111f1,
240 (
int)0x923f82a4, (
int)0xab1c5ed5, (
int)0xd807aa98,
241 (
int)0x12835b01, (
int)0x243185be, (
int)0x550c7dc3,
242 (
int)0x72be5d74, (
int)0x80deb1fe, (
int)0x9bdc06a7,
243 (
int)0xc19bf174, (
int)0xe49b69c1, (
int)0xefbe4786,
244 (
int)0x0fc19dc6, (
int)0x240ca1cc, (
int)0x2de92c6f,
245 (
int)0x4a7484aa, (
int)0x5cb0a9dc, (
int)0x76f988da,
246 (
int)0x983e5152, (
int)0xa831c66d, (
int)0xb00327c8,
247 (
int)0xbf597fc7, (
int)0xc6e00bf3, (
int)0xd5a79147,
248 (
int)0x06ca6351, (
int)0x14292967, (
int)0x27b70a85,
249 (
int)0x2e1b2138, (
int)0x4d2c6dfc, (
int)0x53380d13,
250 (
int)0x650a7354, (
int)0x766a0abb, (
int)0x81c2c92e,
251 (
int)0x92722c85, (
int)0xa2bfe8a1, (
int)0xa81a664b,
252 (
int)0xc24b8b70, (
int)0xc76c51a3, (
int)0xd192e819,
253 (
int)0xd6990624, (
int)0xf40e3585, (
int)0x106aa070,
254 (
int)0x19a4c116, (
int)0x1e376c08, (
int)0x2748774c,
255 (
int)0x34b0bcb5, (
int)0x391c0cb3, (
int)0x4ed8aa4a,
256 (
int)0x5b9cca4f, (
int)0x682e6ff3, (
int)0x748f82ee,
257 (
int)0x78a5636f, (
int)0x84c87814, (
int)0x8cc70208,
258 (
int)0x90befffa, (
int)0xa4506ceb, (
int)0xbef9a3f7,
261 $binStr = $this->char_pad($str);
263 $M = str_split($binStr, 64);
265 $h[0] = (int)0x6a09e667;
266 $h[1] = (int)0xbb67ae85;
267 $h[2] = (int)0x3c6ef372;
268 $h[3] = (int)0xa54ff53a;
269 $h[4] = (int)0x510e527f;
270 $h[5] = (int)0x9b05688c;
271 $h[6] = (int)0x1f83d9ab;
272 $h[7] = (int)0x5be0cd19;
275 for (
$i = 0;
$i < $N;
$i++) {
277 $MI = $this->int_split($M[
$i]);
293 for ($t = 0; $t < 16; $t++) {
297 $_T1 = $this->addmod2n($this->addmod2n($this->addmod2n($this->addmod2n($_h, $this->Sigma1($_e)), $this->Ch($_e, $_f, $_g)), $K[$t]), $W[$t]);
298 $_T2 = $this->addmod2n($this->Sigma0($_a), $this->Maj($_a, $_b, $_c));
303 $_e = $this->addmod2n($_d, $_T1);
307 $_a = $this->addmod2n($_T1, $_T2);
310 for (; $t < 64; $t++) {
312 $_s0 = $W[($t + 1)&0x0F];
313 $_s0 = $this->sigma_0($_s0);
314 $_s1 = $W[($t + 14)&0x0F];
315 $_s1 = $this->sigma_1($_s1);
317 $W[$t&0xF] = $this->addmod2n($this->addmod2n($this->addmod2n($W[$t&0xF], $_s0), $_s1), $W[($t + 9)&0x0F]);
319 $_T1 = $this->addmod2n($this->addmod2n($this->addmod2n($this->addmod2n($_h, $this->Sigma1($_e)), $this->Ch($_e, $_f, $_g)), $K[$t]), $W[$t&0xF]);
320 $_T2 = $this->addmod2n($this->Sigma0($_a), $this->Maj($_a, $_b, $_c));
325 $_e = $this->addmod2n($_d, $_T1);
329 $_a = $this->addmod2n($_T1, $_T2);
332 $h[0] = $this->addmod2n($h[0], $_a);
333 $h[1] = $this->addmod2n($h[1], $_b);
334 $h[2] = $this->addmod2n($h[2], $_c);
335 $h[3] = $this->addmod2n($h[3], $_d);
336 $h[4] = $this->addmod2n($h[4], $_e);
337 $h[5] = $this->addmod2n($h[5], $_f);
338 $h[6] = $this->addmod2n($h[6], $_g);
339 $h[7] = $this->addmod2n($h[7], $_h);
342 $hexStr = sprintf(
"%08x%08x%08x%08x%08x%08x%08x%08x", $h[0], $h[1], $h[2], $h[3], $h[4], $h[5], $h[6], $h[7]);
344 return ($this->toUpper) ? strtoupper($hexStr) : $hexStr;
349 if (!function_exists(
'str_split')) {
354 function str_split($string, $split_length = 1)
356 $sign = ($split_length < 0) ? -1 : 1;
357 $strlen = strlen($string);
358 $split_length = abs($split_length);
360 if (($split_length == 0) || ($strlen == 0)) {
362 }
elseif ($split_length >= $strlen) {
365 $length = $split_length;
367 for (
$i = 0;
$i < $strlen;
$i++) {
368 $i = (($sign < 0) ?
$i + $length :
$i);
369 $result[] = substr($string, $sign * $i, $length);
371 $i = (($sign < 0) ? $i : $i + $length);
373 $length = (($i + $split_length) > $strlen)
374 ? ($strlen - ($i + 1))
395 if (!function_exists(
'sha256')) {
403 function sha256($str, $ig_func =
false)
405 $obj =
new nanoSha2((defined(
'_NANO_SHA2_UPPER')) ?
true :
false);
406 return $obj->hash($str, $ig_func);
416 function _nano_sha256($str, $ig_func =
false)
418 $obj =
new nanoSha2((defined(
'_NANO_SHA2_UPPER')) ?
true :
false);
419 return $obj->hash($str, $ig_func);
423 if (!function_exists(
'hash')) {
431 function hash($algo,
$data)
433 if (empty($algo) || !is_string($algo) || !is_string(
$data)) {
437 if (function_exists($algo)) {
foreach(array('date1', 'date2', 'type', 'renewals', 'width') as $item) $data
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))