[原]php版getFinalKey
1 echo getFinalKey('f9f3c542904bfcd5106bc9c525310a47aedaf692d918ebb0',1150);
2
3 function getFinalKey($gKey, $gScore){
4 if(!$gKey || !isset($gScore)){
5 return (null);
6 } // end if
7 if(strlen($gKey) != 48){
8 return (null);
9 } // end if
10 $gScore = (int) ($gScore);
11 if($gScore > 999999999){
12 return (null);
13 } // end if
14 $_loc10 = $gKey;
15 $gKey = substr($gKey, 42, 6);
16 //$_loc8 = base_convert($gKey, 36, 10);
17 $_loc8 = parseInt($gKey, 36);
18 $_loc4 = toString($_loc8, 35);
19 $_loc13 = strlen($_loc4);
20 $_loc3 = parseInt(substr($gKey, strlen($gKey) - 1), 36) % $_loc13;
21 $_loc6 = toString($gScore, 36);
22 $_loc12 = substr($_loc4, 0, $_loc3);
23 $_loc7 = substr($_loc4, $_loc3);
24 $_loc5 = $_loc3 + 10;
25 $_loc11 = $_loc5 + strlen($_loc6);
26 $_loc9 = array(toString($_loc5, 36), $_loc12, $_loc6, $_loc7, toString($_loc11, 36));//, $_loc10
27 return (implode(',', $_loc9));
28 }
29 $key = 'avy1eo98acf9f3c542904bfcd5106bc9c525310a47aedaf692d918ebb0';
30
31 function deFinalKey($gKey){
32
33 }
34
35 //parseInt
36 function parseInt($string, $radix = '0'){
37 return base_convert($string, $radix, 10);
38 }
39
40 function toString($string, $radix = '0'){
41 return base_convert($string, 10, $radix);
42 }
作者:wc1217 发表于2012-1-11 10:43:59 原文链接
阅读:5 评论:0 查看评论