GalaxyPilot —— D.S


        生命不熄,战斗不止
数据加载中……

一段根据MAC生成序列号的代码

public class getActiveKey {
   public String getRegKey(long aKey) {
   if (aKey<=0)
      aKey=76649179349l;
  char[] aKeyChars = { 49, 87, 89, 90, 86, 50, 74, 78, 88, 82, 72, 51,
    79, 73, 71, 53, 67, 52, 80, 54, 65, 76, 55, 85, 70, 56, 83, 69,
    68, 57, 84, 66, 48, 81, 75, 77 };
  StringBuffer result;
  byte[] keyBytes;
  int patternLength;
  int keyCharsOffset;
  int i;
  int j;
  result = new StringBuffer("#####-#####-#####-#####-#####");
  keyBytes = String.valueOf(aKey).getBytes();
  patternLength = result.length();
  keyCharsOffset = 0;
  i = 0;
  j = 0;
  while ((i < keyBytes.length) && (j < patternLength)) {
   keyCharsOffset = keyCharsOffset + Math.abs(keyBytes[i]);
   while (keyCharsOffset >= aKeyChars.length) {
    keyCharsOffset = keyCharsOffset - aKeyChars.length;
   }
   while ((result.charAt(j) != 35) && (j < patternLength)) {
    j++;
   }
   result.setCharAt(j, aKeyChars[keyCharsOffset]);
   if (i == (keyBytes.length - 1)) {
    i = -1;
   }
   i++;
   j++;
  }
  System.out.println(result.toString());
  return result.toString();
 }
}

aKey 为网卡物理地址的十进制域十六进制

posted on 2006-12-25 17:11 舵手 阅读(2830) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。

网站导航: