<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Str; class EncodeUtil { public static function expiredDataForever($T5Bna, $rvTrU) { return self::expiredData($T5Bna, $rvTrU, 0); } public static function expiredData($T5Bna, $rvTrU, $R21Xk = 3600) { goto wGWB7; ZRQXV: $Z9XXO = dechex(time()); goto e0ols; wGWB7: $rroUS = bin2hex($T5Bna); goto sP0AL; Pqxna: $zlK8N[] = $AYE7s; goto xJHg1; uiiWg: $zlK8N[] = $rroUS; goto RwxTJ; sP0AL: $pjM8S = strtolower(Str::random(6)); goto ZRQXV; RwxTJ: $zlK8N[] = $pjM8S; goto JS5bb; ZPslX: $zlK8N[] = $bu8jE; goto Pqxna; e0ols: $bu8jE = dechex($R21Xk); goto SamQ9; JS5bb: $zlK8N[] = $Z9XXO; goto ZPslX; xJHg1: return join('_', $zlK8N); goto JcEGP; eaa0S: $zlK8N = array(); goto uiiWg; SamQ9: $AYE7s = substr(md5($rvTrU . $rroUS . $pjM8S . $Z9XXO . $bu8jE), 0, 6); goto eaa0S; JcEGP: } public static function expiredDataDecode($YjgEW, $rvTrU) { goto e9x0p; ogH3Y: $rroUS = $ju0cF[0]; goto QKWfW; axVXA: if (count($ju0cF) != 5) { return null; } goto ogH3Y; QKWfW: $pjM8S = $ju0cF[1]; goto Txawu; Txawu: $Z9XXO = $ju0cF[2]; goto L_dMC; OnJ9U: $AYE7s = $ju0cF[4]; goto WdoyB; kjhYV: if ($R21Xk > 0) { $Fcarx = hexdec($Z9XXO); if (time() > $Fcarx + $R21Xk) { return null; } } goto ffklE; ffklE: return hex2bin($rroUS); goto RXISp; CpNsG: if ($AYE7s != $mi5zQ) { return null; } goto Ywy6W; L_dMC: $bu8jE = $ju0cF[3]; goto OnJ9U; e9x0p: $ju0cF = explode('_', $YjgEW); goto axVXA; WdoyB: $mi5zQ = substr(md5($rvTrU . $rroUS . $pjM8S . $Z9XXO . $bu8jE), 0, 6); goto CpNsG; Ywy6W: $R21Xk = hexdec($bu8jE); goto kjhYV; RXISp: } public static function md5WithSalt($SQma7, $kA_1x) { return md5(md5($SQma7) . md5($kA_1x)); } public static function detectCharset($DTnPC, $m5sm2 = array('gbk', 'utf-8')) { $Xjyk4 = strtolower(mb_detect_encoding($DTnPC, $m5sm2)); switch ($Xjyk4) { case 'cp936': return 'gbk'; case 'utf-8': return 'utf-8'; default: return $Xjyk4; } } public static function toUTF8($DTnPC, $bDe_u = array('gbk', 'utf-8')) { $Xjyk4 = mb_detect_encoding($DTnPC, $bDe_u); return iconv($Xjyk4, 'UTF-8', $DTnPC); } }