From b5f2d8ba9b3510ae49453499dd8848bb37c4aece Mon Sep 17 00:00:00 2001 From: Bang1338 <75790567+Bang1338@users.noreply.github.com> Date: Sat, 1 Apr 2023 20:36:42 +0700 Subject: [PATCH] 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 --- Win95Keygen/Form1.cs | 50 ++++++++------------------------------------ 1 file changed, 9 insertions(+), 41 deletions(-) diff --git a/Win95Keygen/Form1.cs b/Win95Keygen/Form1.cs index 6f53143..e7766d7 100644 --- a/Win95Keygen/Form1.cs +++ b/Win95Keygen/Form1.cs @@ -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()