better random and algo

1. don't use "Yandere Dev" method. https://www.c-sharpcorner.com/article/how-to-select-a-random-string-from-an-array-of-strings/
2. 001 to 366 also valid.
3. Use "0XXXXXX" instead of "00XXXXX" (lazy)

Extra: use VB2010 and set .NET Framework to 3.5 or 2
This commit is contained in:
Bang1338 2023-04-01 20:36:42 +07:00 committed by GitHub
parent 62a058535c
commit b5f2d8ba9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 41 deletions

View File

@ -22,56 +22,24 @@ namespace Win95Keygen
}
private static string GenerateKey()
{
//Generate day from 100 to 365
//Generate day from 100 to 366
Random rand;
rand = new Random();
int day = rand.Next(100,365);
int day = rand.Next(100,366);
//Generate year
rand = new Random();
int i = rand.Next(1,9);
string year = "95";
if (i == 1)
{
year = "95";
}
else if (i == 2)
{
year = "96";
}
else if (i == 3)
{
year = "97";
}
else if (i == 4)
{
year = "98";
}
else if (i == 5)
{
year = "99";
}
else if (i == 6)
{
year = "00";
}
else if (i == 7)
{
year = "01";
}
else if (i == 8)
{
year = "02";
}
else if (i == 9)
{
year = "03";
}
string[] yeararray = { "95", "96", "97", "98", "99", "00", "01", "02", "03" };
int index = rand.Next(yeararray.Length);
string year = yeararray[index];
//Static numbers divisible by 7
string divisibleby7 = RandomDivisibleBy7();
//Random numbers
rand = new Random();
int randomnumbers = rand.Next(10000,99999);
//Make the windows 95 key output
//TODO: Use "0XXXXXX" instead of "00XXXXX"
return day.ToString() + year + "-OEM-" + "00" + divisibleby7 + "-" + randomnumbers.ToString();
}
public static string RandomDivisibleBy7()