MyEcplise的注册代码
代码分析
1 package test; 2 3 import java.io.BufferedReader; 4 5 import java.io.IOException; 6 7 import java.io.InputStreamReader; 8 9 public class FTL 10 { 11 12 private static final String LL = "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."; 13 14 public String getSerial(String userId, String licenseNum) 15 { 16 17 java.util.Calendar cal = java.util.Calendar.getInstance(); 18 19 cal.add(1, 3); 20 21 cal.add(6, -1); 22 23 java.text.NumberFormat nf = new java.text.DecimalFormat("000"); 24 25 licenseNum = nf.format(Integer.valueOf(licenseNum)); 26 27 String verTime = new StringBuilder("-").append( 28 29 new java.text.SimpleDateFormat("yyMMdd").format(cal.getTime())) 30 31 .append("0").toString(); 32 33 String type = "YE3MP-"; 34 35 String need = new StringBuilder(userId.substring(0, 1)).append(type) 36 37 .append("300").append(licenseNum).append(verTime).toString(); 38 39 String dx = new StringBuilder(need).append(LL).append(userId) 40 41 .toString(); 42 43 int suf = this.decode(dx); 44 45 String code = new StringBuilder(need).append(String.valueOf(suf)) 46 47 .toString(); 48 49 return this.change(code); 50 51 } 52 53 private int decode(String s) 54 { 55 56 int i; 57 58 char[] ac; 59 60 int j; 61 62 int k; 63 64 i = 0; 65 66 ac = s.toCharArray(); 67 68 j = 0; 69 70 k = ac.length; 71 72 while (j < k) 73 { 74 75 i = (31 * i) + ac[j]; 76 77 j++; 78 79 } 80 81 return Math.abs(i); 82 83 } 84 85 private String change(String s) 86 { 87 88 byte[] abyte0; 89 90 char[] ac; 91 92 int i; 93 94 int k; 95 96 int j; 97 98 abyte0 = s.getBytes(); 99 100 ac = new char[s.length()]; 101 102 i = 0; 103 104 k = abyte0.length; 105 106 while (i < k) 107 { 108 109 j = abyte0[i]; 110 111 if ((j >= 48) && (j <= 57)) 112 { 113 114 j = (((j - 48) + 5) % 10) + 48; 115 116 } else if ((j >= 65) && (j <= 90)) 117 { 118 119 j = (((j - 65) + 13) % 26) + 65; 120 121 } else if ((j >= 97) && (j <= 122)) 122 { 123 124 j = (((j - 97) + 13) % 26) + 97; 125 126 } 127 128 ac[i] = (char) j; 129 130 i++; 131 132 } 133 134 return String.valueOf(ac); 135 136 } 137 138 public FTL() 139 { 140 141 super(); 142 143 } 144 145 public static void main(String[] args) 146 { 147 148 try 149 { 150 151 System.out.println("please input register name:"); 152 153 BufferedReader reader = new BufferedReader(new InputStreamReader( 154 155 System.in)); 156 157 String userId = null; 158 159 userId = reader.readLine(); 160 161 FTL myeclipsegen = new FTL(); 162 163 String res = myeclipsegen.getSerial(userId, "5"); 164 165 System.out.println("Serial:" + res); 166 167 reader.readLine(); 168 169 } catch (IOException ex) 170 { 171 172 } 173 174 } 175 176 }
代码截图
作者:小a玖拾柒
-------------------------------------------
个性签名: 所有的事情到最後都是好的,如果不好,那說明事情還沒有到最後~
本文版权归作者【小a玖拾柒】和【博客园】共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利!