<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Str; class EncodeUtil { public static function expiredDataForever($cgHv6, $dwwIV) { return self::expiredData($cgHv6, $dwwIV, 0); } public static function expiredData($cgHv6, $dwwIV, $OlPgA = 3600) { goto IaAkm; I3piX: $oK4I3[] = $eHCvw; goto HRprt; BPpSW: $Zr7n_ = dechex(time()); goto rj76Z; IaAkm: $UyhEh = bin2hex($cgHv6); goto Y33Dx; HRprt: $oK4I3[] = $Zr7n_; goto esM5n; tawNd: $oK4I3 = array(); goto DaYw1; jC5rz: return join('_', $oK4I3); goto GBW6a; esM5n: $oK4I3[] = $wHU7O; goto zZhhD; rj76Z: $wHU7O = dechex($OlPgA); goto n94Hl; DaYw1: $oK4I3[] = $UyhEh; goto I3piX; Y33Dx: $eHCvw = strtolower(Str::random(6)); goto BPpSW; zZhhD: $oK4I3[] = $qwA4o; goto jC5rz; n94Hl: $qwA4o = substr(md5($dwwIV . $UyhEh . $eHCvw . $Zr7n_ . $wHU7O), 0, 6); goto tawNd; GBW6a: } public static function expiredDataDecode($VzVt9, $dwwIV) { goto MCOEV; iqnFp: $eHCvw = $v2qOY[1]; goto fANSB; MCOEV: $v2qOY = explode('_', $VzVt9); goto PH1Ok; N3rYV: $wHU7O = $v2qOY[3]; goto mjNkD; PH1Ok: if (count($v2qOY) != 5) { return null; } goto nVIiH; mjNkD: $qwA4o = $v2qOY[4]; goto Zy08p; nVIiH: $UyhEh = $v2qOY[0]; goto iqnFp; Zy08p: $o3hyb = substr(md5($dwwIV . $UyhEh . $eHCvw . $Zr7n_ . $wHU7O), 0, 6); goto lCCQS; H1zyj: if ($OlPgA > 0) { $emspg = hexdec($Zr7n_); if (time() > $emspg + $OlPgA) { return null; } } goto JWv8w; lCCQS: if ($qwA4o != $o3hyb) { return null; } goto Y9hKI; fANSB: $Zr7n_ = $v2qOY[2]; goto N3rYV; Y9hKI: $OlPgA = hexdec($wHU7O); goto H1zyj; JWv8w: return hex2bin($UyhEh); goto qunzY; qunzY: } public static function md5WithSalt($Y6QUz, $xsfm6) { return md5(md5($Y6QUz) . md5($xsfm6)); } public static function detectCharset($cgjRu, $l2aF3 = array('gbk', 'utf-8')) { $XSacc = strtolower(mb_detect_encoding($cgjRu, $l2aF3)); switch ($XSacc) { case 'cp936': return 'gbk'; case 'utf-8': return 'utf-8'; default: return $XSacc; } } public static function toUTF8($cgjRu, $aCliJ = array('gbk', 'utf-8')) { $XSacc = mb_detect_encoding($cgjRu, $aCliJ); return iconv($XSacc, 'UTF-8', $cgjRu); } }