黑马程序员技术交流社区

标题: java写的注册机,生成MyEclipse8.6注册码(给大家分享一下) [打印本页]

作者: 李震 李震 李震    时间: 2012-4-11 00:21
标题: java写的注册机,生成MyEclipse8.6注册码(给大家分享一下)
  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4. import java.text.DecimalFormat;
  5. import java.text.NumberFormat;
  6. import java.text.SimpleDateFormat;
  7. import java.util.Calendar;


  8. public class MyEclipseKeyGen {
  9. 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.";


  10. public String getSerial(String userId, String type) {
  11. NumberFormat nf = new DecimalFormat("000");
  12. Calendar cal = Calendar.getInstance();
  13. cal.add(Calendar.YEAR, 3);
  14. cal.add(Calendar.DAY_OF_YEAR, -1);
  15. String licenseNum = nf.format((int) (Math.random() * 1000));
  16. String expTime = new StringBuilder("-").append(
  17. new SimpleDateFormat("yyMMdd").format(cal.getTime())).append(
  18. "0").toString();
  19. String need = new StringBuilder(userId.substring(0, 1)).append("Y")
  20. .append(type).append("-100").append(licenseNum).append(expTime)
  21. .toString();
  22. String dx = new StringBuilder(need).append(LL).append(userId)
  23. .toString();
  24. int suf = this.decode(dx);
  25. String code = new StringBuilder(need).append(String.valueOf(suf))
  26. .toString();
  27. return this.change(code);
  28. }


  29. private int decode(String s) {
  30. int i;
  31. char[] ac;
  32. int j;
  33. int k;
  34. i = 0;
  35. ac = s.toCharArray();
  36. j = 0;
  37. k = ac.length;
  38. while (j < k) {
  39. i = (31 * i) + ac[j];
  40. j++;
  41. }
  42. return Math.abs(i);
  43. }


  44. private String change(String s) {
  45. byte[] abyte0;
  46. char[] ac;
  47. int i;
  48. int k;
  49. int j;
  50. abyte0 = s.getBytes();
  51. ac = new char[s.length()];
  52. i = 0;
  53. k = abyte0.length;
  54. while (i < k) {
  55. j = abyte0[i];
  56. if ((j >= 48) && (j <= 57)) {
  57. j = (((j - 48) + 5) % 10) + 48;
  58. } else if ((j >= 65) && (j <= 90)) {
  59. j = (((j - 65) + 13) % 26) + 65;
  60. } else if ((j >= 97) && (j <= 122)) {
  61. j = (((j - 97) + 13) % 26) + 97;
  62. }
  63. ac[i] = (char) j;
  64. i++;
  65. }
  66. return String.valueOf(ac);
  67. }


  68. public static void main(String[] args) {
  69. try {
  70. System.out.println("please input register name:");
  71. BufferedReader reader = new BufferedReader(new InputStreamReader(
  72. System.in));
  73. String userId = null;
  74. userId = reader.readLine();
  75. if(userId == null || "".equals(userId)){
  76. System.out.println("name is null");
  77. System.exit(0);
  78. }
  79. MyEclipseKeyGen myeclipsegen = new MyEclipseKeyGen();
  80. String res = myeclipsegen.getSerial(userId, "E3MS");
  81. System.out.println("Serial:" + res);
  82. reader.readLine();
  83. } catch (IOException ex) {
  84. ex.printStackTrace();
  85. }
  86. }
  87. }
复制代码
输入名字即可:
name:lizhen
key:yLR8ZF-655332-6059545238330702
MyEclipse注册码
作者: 王硕'    时间: 2012-4-11 09:44
膜拜,高手啊,请问注册机什么原理。。 简单描述下
作者: 黑马张平    时间: 2012-4-11 09:49
高手 。!!
作者: 李震 李震 李震    时间: 2012-4-11 12:26
  网上找的一段注册机代码,分享给大家,不好意思,不是我写的额。




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2