myEclipse6.5注册码生成

 1 import java.text.DecimalFormat;
 2 import java.text.NumberFormat;
 3 import java.text.SimpleDateFormat;
 4 import java.util.Calendar;
 5 
 6 public class MyEclipseCrack  {
 7     //
 8     public static final void main(String[] args) {
 9         //Subscriber
10         String id = "admin";
11         String num = "999";
12         System.out.println("Subscriber:" + id);
13         System.out.println("Subscription Code:"
14                 + getSerial(id, "100", num, false));
15     }
16 
17     public static String getSerial(String userId, String version,
18             String licenseNum, boolean selected) {
19         Calendar cal = Calendar.getInstance();
20         cal.add(1, 3);
21         cal.add(6, -1);
22         NumberFormat nf = new DecimalFormat("000");
23         licenseNum = nf.format(Integer.valueOf(licenseNum));
24         String verTime = selected ? (new StringBuffer("-")).append(
25                 (new SimpleDateFormat("yyMMdd")).format(cal.getTime())).append(
26                         //1612310  时间,如果注册码过期的话,把其中“-1612310”的改成你想要的时间。(其中“-1612310”是2016年12月31日的意思)
27                 "0").toString() : "-1612310";
28         String type = "YE3MB-";
29         String need = (new StringBuffer(String.valueOf(userId.substring(0, 1))))
30                 .append(type).append(version).append(licenseNum)
31                 .append(verTime).toString();
32         String dx = (new StringBuffer(String.valueOf(need)))
33                 .append(
34                         "Decompiling this copyrighted software is a violation of both your license agreement and the Digital Millenium Copyright Act of 1998 (http://www.loc.gov/copyright/legislation/dmca.pdf). Under section 1204 of the DMCA, penalties range up to a $500,000 fine or up to five years imprisonment for a first offense. Think about it; pay for a license, avoid prosecution, and feel better about yourself.")
35                 .append(userId).toString();
36         int suf = decode(dx);
37         String code = (new StringBuffer(String.valueOf(need))).append(
38                 String.valueOf(suf)).toString();
39         return change(code);
40     }
41 
42     private static String change(String s) {
43         byte abyte0[] = s.getBytes();
44         char ac[] = new char[s.length()];
45         int i = 0;
46         for (int k = abyte0.length; i < k; i++) {
47             int j = abyte0[i];
48             if (j >= 48 && j <= 57)
49                 j = ((j - 48) + 5) % 10 + 48;
50             else if (j >= 65 && j <= 90)
51                 j = ((j - 65) + 13) % 26 + 65;
52             else if (j >= 97 && j <= 122)
53                 j = ((j - 97) + 13) % 26 + 97;
54             ac[i] = (char) j;
55         }
56         return String.valueOf(ac);
57     }
58 
59     private static int decode(String s) {
60         int i = 0;
61         char ac[] = s.toCharArray();
62         int j = 0;
63         for (int k = ac.length; j < k; j++)
64             i = 31 * i + ac[j];
65         return Math.abs(i);
66     }
67 }
原文地址:https://www.cnblogs.com/gxl00/p/4614659.html