<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SQL Assistant v5.xx Key Generator</title>
<style type="text/css">
</style>
<script language="javascript" type="text/javascript">
var toInt = function(x) { return Math.floor(x); }
var randInt = function () { return toInt(Math.random() * Math.pow(2, 32)); }
var licType,
strMOrL,
log = true,
bigNoFlag;
window.onload = function() {
licType = 'E';
document.getElementById("thekey").innerHTML = getLicense();
}
// "E" : Enterprise Edition
// "P" : Professional Edition
// "S" : Site Edition
// "1" : Standard Edition
function genkey(e)
{
// get either event (W3C) or
// window event object (MSIE)
e = e || window.event;
// get either target (W3C) or event source (MSIE)
var t = e.target || e.srcElement;
switch(t.value) {
case '1': case 'S': case 'P': case 'E':
licType = t.value;
document.getElementById("thekey").innerHTML = getLicense();
//alert("Sql Assistant 5 Key:\r\n" + getLicense());
break;
default:
}
}
function getLicense() {
// 注册码格式 key0 key1 key2 key3 key4 以 - 分隔
// xx-xx-xx-xx-xx
// Example:
// Standard 版
// 030401EE-902943-3W4LH6A-1MOL-4953
var key0 = '',
key1 = '',
key2 = '',
key3 = '',
key4 = '';
// step 1 生成000000-999999随机字符 xx(key1)
// step 2 将上一步6位数每位数值相加再+22,作最后一组(key4)前两位字符
// step 3 先获得注册类型xxxx 后的1位 值 是 x 或x,计算出一个值
// 如果是 x,要满足
// 1+值(2153483746)- 第2组最后两字符数值 99 +100000 * 第5组前两字符数值
// 或
// 1+值(3227225570)- 第2组最后两字符数值 99 +100000 * 第5组前两字符数值
// 如果是 xx ,要满足
// 16+值(2153483731)- 第2组最后两字符数值 99 +100000 * 第5组前两字符数值
// 或
// 16+值(3227225555)- 第2组最后两字符数值 99 +100000 * 第5组前两字符数值
// 根据step3 值,计算key4最后两字符
// 如果=2153483746,各位数值相加再+22 =65
// step 4 生成key2,满足
// 字符先反向,然后取每位在字符串xxxxxxxxxx中的索引值,再乘上以1为初值,32倍递增的基数
// 加起来=step3中的值
// step 5 key3的生成
// 第一位,注册类型, xxxxx
// 第二位,随机是 x 或 xxx
// 后两位随机生成
// step 6 key0
// 由key1,key2拼接与key3,key4拼接的字符串,每位ASCII数值相加,得到各4位一组,一共8位的16进制字符
if (randInt() % 2 > 0)
strMOrL = "M";
else
strMOrL = "L";
if (randInt() % 2 > 0)
bigNoFlag = 1;
else
bigNoFlag = 0;
key3 = licType + strMOrL + getRandomString2();
// 生成000000-999999随机字符
var ikey1 = randInt() % 999999 + 0;
key1 = padZero(ikey1, 6, 10);
// key4前两字符
var firstTwoLetterOfKey4 = getStrSum(key1, 0, 6) + 22;
// 此值为key3进行计算后乘出的值
var value = getValue(key1, firstTwoLetterOfKey4);
var lastTwoLetterOfKey4 = getLastTwoLetterOfKey4(value);
key4 = '' + firstTwoLetterOfKey4 + '' + lastTwoLetterOfKey4;
key2 = getKey2(value);
key0 = getKey0(key1 + key2, key3 + key4);
return key0 + "-DD" + key1 + "-" + key2 + "-" + key3 + "-" + key4;
}
function getStrSum(str, start, len) {
var result = 0;
for (var i = start; i < len; i++)
result += parseInt(str.charAt(i));
return result;
}
/*
function getFirstTwoLetterOfKey4()
{
return randInt() % 54 + 22;
}
*/
function getValue(key1, digits)
{
var lastTwoLetterOfKey1 = key1.substr(key1.length - 2);
var i3 = parseInt(lastTwoLetterOfKey1);
if(strMOrL == 'M') {
if(bigNoFlag == 0)
i3 += 2147483647 + 100000 * digits;
else
i3 += 3221225471 + 100000 * digits;
}
else {
if(bigNoFlag == 0)
i3 += 3221225456 + 100000 * digits;
else
i3 += 2147483632 + 100000 * digits;
}
return i3;
}
function getLastTwoLetterOfKey4(value) {
var s = value.toString(),
result = 0;
for (var i = 0; i < s.length; i++)
result += parseInt(s.charAt(i));
result += 22;
return result;
}
function getKey2(num)
{
var result = '',
str = '123456789ABCDEFGHIKJLMNOPQRSTUV',
base = 1073741824;
while (base > 0) {
if (toInt(num / base) > 0) {
var i = toInt(num / base);
// result += i;
num = num - i * base;
result += str.charAt(i - 1);
}
else {
// 取个不在字符串中的字符,最简单的是取0
result += getRandomString1();
// result += "0";
}
base = toInt(base / 32);
}
return result;
}
function getKey0(str1, str2)
{
var result = 0;
for (var i = 0; i < str1.length; i++)
result += str1.charCodeAt(i);
str1 = padZero((toInt(result % 9) * 1000 + result), 4, 16);
result = 0;
for (var i = 0; i < str2.length; i++)
result += str2.charCodeAt(i);
str2 = padZero((toInt(result % 9) * 1000 + result), 4, 16);
return str1 + str2;
}
function padZero(num, len, radix)
{
var zs = new Array(len + 1).join('0');
return (zs.substr(num.toString(radix).length) + num.toString(radix)).toUpperCase();
}
function getRandomString1()
{
var ri = randInt() % 5 + 87;
if(ri > 90)
ri = 48;
return String.fromCharCode(ri);
}
function getRandomString2()
{
var sb = '';
for (var i = 0; i < 2; i++) {
var ri = randInt() % 28 + 65;
if(ri > 90)
ri = randInt() % 10 + 48;
sb += String.fromCharCode(ri);
}
return sb;
}
</script>
</head>
<body width="50%">
<h1 align="center" class="regsel" lang="en">SQL Assistant v6.xx<br>Key Generator</h1>
<div align="center">
<table>
<tr><td align="left">
<input type=radio name="regtype" value="E" onclick="genkey(event);" checked>Enterprise Edition<br>
<input type=radio name="regtype" value="P" onclick="genkey(event);">Professional Edition<br>
<input type=radio name="regtype" value="S" onclick="genkey(event);">Site Edition<br>
<input type=radio name="regtype" value="1" onclick="genkey(event);">Standard Edition<br>
</td></tr>
</table>
<br>
<br>
<div id="thekey"></div>
</div>
<br>
</body>
</html>
- 1
- 2
- 3
- 4
- 5
- 6
前往页