zoukankan      html  css  js  c++  java
  • [原]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 查看评论
  • 相关阅读:
    maven编译时GBK错误
    生产环境中,通过域名映射ip切换工具SwitchHosts
    Java中的Filter过滤器
    Notepad++远程连接Linux系统
    MySQL 创建帐号和对表的导入导出
    XML 初识
    MySQL 字符集的设置
    C# 委托
    肖申克的救赎
    C#指针 常用手段
  • 原文地址:https://www.cnblogs.com/wc1217/p/2387568.html
Copyright © 2011-2022 走看看