账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    这段代码如何转换成PHP
    32
    0

    private String uc_authcode(String string, String operation, String key, int expiry) {

        byte ckey_length = 1;
        key = this.md5(key != null?key:UC_KEY);
        String keya = this.md5(this.substr(key, 0, 16));
        String keyb = this.md5(this.substr(key, 16, 16));
        String keyc = "a";
        String cryptkey = keya + this.md5(keya + keyc);
        int key_length = cryptkey.length();
        string = operation.equals("DECODE")?this.base64_decode(this.substr(string, ckey_length)):this.sprintf("%010d", (long)(expiry > 0?expiry:0)) + this.substr(this.md5(string + keyb), 0, 16) + string;
        int string_length = string.length();
        StringBuffer result1 = new StringBuffer();
        int[] box = new int[256];
    
        for(int rndkey = 0; rndkey < 256; box[rndkey] = rndkey++) {
            ;
        }
    
        int[] var19 = new int[256];
    
        int j;
        for(j = 0; j <= 255; ++j) {
            var19[j] = cryptkey.charAt(j % key_length);
        }
    
        j = 0;
    
        int a;
        int result;
        for(a = 0; a < 256; ++a) {
            j = (j + box[a] + var19[a]) % 256;
            result = box[a];
            box[a] = box[j];
            box[j] = result;
        }
    
        j = 0;
        a = 0;
    
        for(result = 0; result < string_length; ++result) {
            a = (a + 1) % 256;
            j = (j + box[a]) % 256;
            int tmp = box[a];
            box[a] = box[j];
            box[j] = tmp;
            result1.append((char)(string.charAt(result) ^ box[(box[a] + box[j]) % 256]));
        }
    
        if(!operation.equals("DECODE")) {
            return keyc + this.base64_encode(result1.toString()).replaceAll("=", "");
        } else {
            String var20 = result1.substring(0, result1.length());
            return (Integer.parseInt(this.substr(var20.toString(), 0, 10)) == 0 || Long.parseLong(this.substr(var20.toString(), 0, 10)) > 0L) && this.substr(var20.toString(), 10, 16).equals(this.substr(this.md5(this.substr(var20.toString(), 26) + keyb), 0, 16))?this.substr(var20.toString(), 26):"";
        }
    }
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 山河拱手 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部