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 != 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();
} 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();
} 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();
} 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] = 14; // 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){
System.out.println("请输入用户名:");
Scanner scanner = new Scanner(System.in);
String username = scanner.next();
Random r = new Random();
System.out.println(MakeKey(username, 0, r.nextInt(100000)));
}
}

Idea KeyGen的更多相关文章

  1. JetBrains.DotMemory.Keygen.4.x

    GoogleN久都没找到这一类的工具. 只好折腾一个了. CSDN 免积分 0积分 下载 http://download.csdn.net/detail/caizz520/7477865 全球首发-V ...

  2. [Keygen]IntelliJ IDEA 14.1.7

    IntelliJ IDEA 14.1.7 Keygen package com.candy.keygen.intelliJIdea; import java.math.BigInteger; impo ...

  3. LLBLGen Pro v4.2_Patch+Keygen

    将dll文件覆盖安装目录下的文件,之后用算号器算出license文件,将license文件放在安装目录下即可. 算号器是在http://www.dxper.net/thread-408-1-1.htm ...

  4. IntelliJ IDEA 13 Keygen

    import java.math.BigInteger; import java.util.Date; import java.util.Random; import java.util.zip.CR ...

  5. 新增的output元素 progress元素 meter元素 keygen元素

    结果图 <output>是双标签 name:定义对象的唯一属性 for:定义输出域相关的一个或多个元素. form:定义所属的一个至多个表单. progress和meter一般和JS一起使 ...

  6. Adobe Acrobat XI Pro 两种破解方式 Keygen秘钥 license替换 亲测有效

    大家平时看paper比较多的话想必都是用Adobe Acrobat而非Adobe Reader吧,其功能全面之处就不啰嗦了,下面给大家分享下Adobe Acrobat XI Pro的两种破解方式(两种 ...

  7. Centos6架设GIT服务,windows客户端使用TortoiseGit加载KEYGEN连接GIT服务器

    前几天得空,想起前一阵学了GIT还没好好实践,就在虚拟机中安装测试了一下,并简单记录了CENTOS6中GIT安装,ssh-keygen生成,客户端使用TortoiseGit加载KEYGEN连接GIT服 ...

  8. IDEA12 KeyGen Download List

    When you use IDEA to develop Java, you can use the following file to generate lincese. Because CNBlo ...

  9. Red-Gate.NET.Reflector.v8.0.1.308(内含注册机Keygen与注册图解)

    Red-Gate.NET.Reflector.v8.0.1.308(内含注册机Keygen与注册图解)   反编译神器 内含软件安装包.注册机及插件集合. 这里说下注册方法,注意不要在联网的情况下注册 ...

随机推荐

  1. 关于setInterval()里的this和细节

    setInterval(fn,t);里的fn中,要使用外部类的this,则需要先将this保存起来,再使用保存的this,不能直接使用this,里面的this是指向window对象,记住setInte ...

  2. Java 标准日志工具 Log4j 的使用(附源代码)

    源代码下载 Log4j 是事实上的 Java 标准日志工具.会不会用 Log4j 在一定程度上可以说是衡量一个开发人员是否是一位合格的 Java 程序员的标准.如果你是一名 Java 程序员,如果你还 ...

  3. Android Studio导入Project的方法

    Android Studio到现在已经发展到0.8+的版本了,最近也在试着使用它,原因是多方面的,一个毕竟是未来的趋势,二则是github上越来越多的大牛开源项目都是基于Android Studio的 ...

  4. c# 图片XML序列化与反序列化

    var xmlDoc = new XmlDocument(); xmlDoc.Load(@"C:\Users\*\Desktop\*.xml"); ].ChildNodes[]; ...

  5. linq字符串搜索条件,排序条件-linq动态查询语句 Dynamic LINQ

    在做搜索和排序的时候,往往是前台传过来的字符串做条件,参数的数量还不定,这就需要用拼sql语句一样拼linq语句.而linq语句又是强类型的,不能用字符串拼出来. 现在好了,有个开源的linq扩展方法 ...

  6. js实现复选框的全选、全不选、反选

    js中实现复选框的全选,全不选以及反选,分为两种情况: (1)选中“请选择”前面的复选框实现全选,不选中“请选择”前面的复选框实现全不选 <!DOCTYPE html PUBLIC " ...

  7. Hadoop2.4代码的坑

    org.apache.hadoop.hdfs.server.datanode.BlockPoolManager 和org.apache.hadoop.hdfs.server.datanode.Data ...

  8. SQL SERVER 只有MDF文件的恢复

    方式一: .create a database same name as .mdf file; .Stop SQL Server; . recover .mdf file; . Start SQL S ...

  9. mysql-master-ha

    https://code.google.com/p/mysql-master-ha/wiki/TableOfContents?tm=6 http://www.cnblogs.com/gomysql/c ...

  10. mysqldump: Got error: 1556: You can't use locks with log tables. when using LOCK TABLES

    mysqldump: Got error: 1556: You can't use locks with log tables. when using LOCK TABLES 我是把一些mysqldu ...