[原]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 查看评论

转载于:https://www.cnblogs.com/wc1217/archive/2012/01/11/2387568.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值