- 积分
- 0
- 在线时间
- 7 小时
- 主题
- 0
- 注册时间
- 2015-4-30
- 帖子
- 7
- 最后登录
- 2019-10-31
- 帖子
- 7
- 软币
- 152
- 在线时间
- 7 小时
- 注册时间
- 2015-4-30
|
发表于 2017-5-5 16:14:20
|
显示全部楼层
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Infragistics_2016._2_Key
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Generate();
}
private void Generate()
{
string ProductCode = "91";
int MajorVersion = 2016;
int MinorVersion = 2;
int VersionCode = ((MajorVersion - 2000) * 2) + MinorVersion - 9;
Dictionary<string, int[]> dictMsk = new Dictionary<string, int[]>()
{
{ "91", new int[] {40,14,22,10,11,10,13,20,11,12,10,23,15,23,15,14,13,24,14,11,22,18,11,10,21,20,20,23,22,20,15,24,17,21,20,20,23,23,10,21,14,12} },
{ "92", new int[] {23,21,33,13,23,10,14,13,17,12,29,33,12,23,10,14,13,12,38,11,21,14,12,19,10,13,12,23,32,13,17,14,12,15,14,20,24,24,11,12,10,14} }
};
string MskCode = dictMsk[ProductCode][VersionCode - 12].ToString("00");
Random rnd = new Random();
int nCount = 10;
string strLog = nCount.ToString() + " LicenseKeys for " + MajorVersion.ToString() + "." + MinorVersion.ToString() + ": \r\n\r\n";
for (int LV = 1; LV <= nCount; LV++)
{
string RandomValue = rnd.Next(111, 999).ToString();
string LicenseKey = ProductCode + VersionCode.ToString("00") + MskCode + "00" + RandomValue;
for (int k = 1; k <= 4; k++)
{
long num = 0x1bL;
long num2 = 0x1fL;
long num4 = 0x31ddL;
long num5 = 0x178L;
for (int l = 0; l < LicenseKey.Length; l++)
{
long num3 = (long)LicenseKey[l];
num3 = (num3 * 3L) + num2;
num5 += num * (num3 * num3);
num2 = (long)LicenseKey[l];
num2 *= 3L;
num4 += num5;
num += 1L;
long[] value = new long[] { num5, num4, num4 };
int[] maximum = new int[] { 0xf423f, 0x1869f, 0x270f };
int[] factor = new int[] { 0xaa4c7, 0xe4c7, 0x270d };
for (int m = 0; m <= 2; m++)
{
if (value[m] > maximum[m])
{
long num11 = value[m] - maximum[m];
long num22 = num11 / ((long)factor[m]);
if ((num11 % ((long)factor[m])) != 0L)
{ num22 += 1L; }
value[m] -= num22 * factor[m];
}
if (m == 0) num5 = value[0];
else
{ num4 = value[m]; if (m == 1) value[2] = num4; }
}
}
LicenseKey = LicenseKey + ((char)((ushort)(0x30L + (((num4 + 1552) % 72) % 10L)))).ToString();
if (k < 4) LicenseKey = LicenseKey + rnd.Next(1, 9).ToString();
}
LicenseKey = LicenseKey.Insert(4, "-").Insert(12, "-");
strLog = strLog + LicenseKey + "\r\n";
}
Clipboard.SetText(strLog);
MessageBox.Show(nCount.ToString() + " LicenseKeys for " + MajorVersion.ToString() + "." + MinorVersion.ToString() + " copied to clipboard !");
}
}
}
|
|