keygen

public class keygen {

    private static final int version=14;

    /**
     * @param s
     * @param i
     * @param bytes
     * @return
     */
    public static short getCRC(String s, int i, byte bytes[]) {
        CRC32 crc32 = new CRC32();
        if (s != null) {
            for (int j = 0; j < s.length(); j++) {
                char c = s.charAt(j);
                crc32.update(c);
            }
        }
        crc32.update(i);
        crc32.update(i >> 8);
        crc32.update(i >> 16);
        crc32.update(i >> 24);
        for (int k = 0; k < bytes.length - 2; k++) {
            byte byte0 = bytes[k];
            crc32.update(byte0);
        }
        return (short) (int) crc32.getValue();
    }

    /**
     * @param biginteger
     * @return String
     */
    public static String encodeGroups(BigInteger biginteger) {
        BigInteger beginner1 = BigInteger.valueOf(0x39aa400L);
        StringBuilder sb = new StringBuilder();
        for (int i = 0; biginteger.compareTo(BigInteger.ZERO) != 0; i++) {
            int j = biginteger.mod(beginner1).intValue();
            String s1 = encodeGroup(j);
            if (i > 0) {
                sb.append("-");
            }
            sb.append(s1);
            biginteger = biginteger.divide(beginner1);
        }
        return sb.toString();
    }

    /**
     * @param i
     * @return
     */
    public static String encodeGroup(int i) {
        StringBuilder sb = new StringBuilder();
        for (int j = 0; j < 5; j++) {
            int k = i % 36;
            char c;
            if (k < 10) {
                c = (char) (48 + k);
            } else {
                c = (char) ((65 + k) - 10);
            }
            sb.append(c);
            i /= 36;
        }
        return sb.toString();
    }

    /**
     * @param name
     * @param days
     * @param id
     * @return
     */
    public static String MakeKey(String name, int days, int id) {
        id %= 100000;
        byte bkey[] = new byte[12];
        bkey[0] = (byte) 1; // Product type: IntelliJ IDEA is 1
        bkey[1] = version;
        Date d = new Date();
        long ld = (d.getTime() >> 16);
        bkey[2] = (byte) (ld & 255);
        bkey[3] = (byte) ((ld >> 8) & 255);
        bkey[4] = (byte) ((ld >> 16) & 255);
        bkey[5] = (byte) ((ld >> 24) & 255);
        days &= 0xffff;
        bkey[6] = (byte) (days & 255);
        bkey[7] = (byte) ((days >> 8) & 255);
        bkey[8] = 105;
        bkey[9] = -59;
        bkey[10] = 0;
        bkey[11] = 0;
        int w = getCRC(name, id % 100000, bkey);
        bkey[10] = (byte) (w & 255);
        bkey[11] = (byte) ((w >> 8) & 255);
        BigInteger pow = new BigInteger("89126272330128007543578052027888001981", 10);
        BigInteger mod = new BigInteger("86f71688cdd2612ca117d1f54bdae029", 16);
        BigInteger k0 = new BigInteger(bkey);
        BigInteger k1 = k0.modPow(pow, mod);
        String s0 = Integer.toString(id);
        String sz = "0";
        while (s0.length() != 5) {
            s0 = sz.concat(s0);
        }
        s0 = s0.concat("-");
        String s1 = encodeGroups(k1);
        s0 = s0.concat(s1);
        return s0;
    }

    public static void main(String[] args) {
        Random r = new Random();
        System.out.println("user name:" + "OSC" + " KEY:" + MakeKey("OSC", 0, r.nextInt(Integer.MAX_VALUE)));
    }
}
时间: 2024-12-20 09:21:20

keygen的相关文章

Idea KeyGen

import java.math.BigInteger; import java.util.Date; import java.util.Random; import java.util.Scanner; import java.util.zip.CRC32; public class KeyGen { public static short getCRC(String s, int i, byte bytes[]){ CRC32 crc32 = new CRC32(); if (s != nu

html5-fieldset和legend和keygen元素的用法

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>fieldset和legend和keygen元素的用法</title></head><body><!--     <form action="">    <fieldset> 

Python Wing IDE5.1.8-1 KeyGen

源码来源于PYG老大的博客: http://www.dllhook.com/post/36.html 测试官网最新版可以注册成功: 源码是Python写的,所以需要先安装Python2.7, 3.x的不能运行,飘大已经在博客说了. 注册机源码: # -*- coding: cp936 -*- import sha import string BASE2 = '01' BASE10 = '0123456789' BASE16 = '0123456789ABCDEF' BASE30 = '12345

IntelliJ IDEA 14 Keygen

1 package keygen; 2 3 import java.math.BigInteger; 4 import java.util.Date; 5 import java.util.zip.CRC32; 6 7 public class Keygen { 8 9 private static final int version = 14; 10 11 /** 12 * @param s 13 * @param i 14 * @param bytes 15 * @return 16 */

[转]JetBrains IntelliJ IDEA 13 Keygen (Java Source Code)

转载:http://www.rover12421.com/2013/12/09/jetbrains-intellij-idea-13-keygen-java-source-code.html JetBrains IntelliJ IDEA 13 Keygen : import java.math.BigInteger; import java.util.Date; import java.util.Random; import java.util.zip.CRC32; public class

Hydro Tec v5.1.0.2 Incl KeyGen(德语软件)

圆方家具设计系统6.8MagiCAD2010 2010.11中文版全功能支持32位64位+送3G教学Flotherm v9.1v9.3支持32位64位 送海量学习资料资料Geosoft.Oasis.Montaj.v7.5.1 Geosoft Oasis Montaj 7.5 Landmark EDT R5000.1.9.0 1DVDV-ELEQ v1.1.0 电气仿真系统 中文版Eudaptics Viscovery SOMine v5.0.1(数据挖掘系统)韩国电气仿真软件V-ELEQWeat

Adobe Acrobat XI Pro 破解 Keygen秘钥 license替换

大家平时看paper比较多的话想必都是用Adobe Acrobat而非Adobe Reader吧,其功能全面之处就不啰嗦了,下面给大家分享下Adobe Acrobat XI Pro的两种破解方式(两种方式我都用过且有效): 1)Acrobat XI pro Keygen: 这是下载软件的时候一般都会附带的破解工具,之前很长一段时间都在用这个工具,虽然有效但有两个缺点:一是需要脱机激活,在破解过程中需要故意断下网,保证无网络相应工具才能执行正常破解步骤:二是这个工具破解不是永久破解,大概可能一个月

Navicat Premium (patch and keygen)

标签:Navicat 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://sofar.blog.51cto.com/353572/1304734 Navicat Premium(一款支持多种数据库的管理工具): http://download.navicat.com/download/navicat110_premium_en_x86.exe http://download.navicat.com/download/navicat

LLBLGen Pro v4.2_Patch+Keygen

将dll文件覆盖安装目录下的文件,之后用算号器算出license文件,将license文件放在安装目录下即可. 算号器是在http://www.dxper.net/thread-408-1-1.html这儿下载的.感谢liangxiaorui.4.0的下载链接:http://pan.baidu.com/share/link?shareid=3260296754&uk=4179368456 密码:qrgz 本人基于4.0的补丁,制作了4.2的补丁dll文件.使用算号器算一下就可以使用了.前人栽树,