Created
June 4, 2025 13:56
-
-
Save AlLiberali/cce6daed02e39d7cb6d13d3afa38f716 to your computer and use it in GitHub Desktop.
Revisions
-
AlLiberali created this gist
Jun 4, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ String Keygen() { Byte[] key = new Byte[16] { 4, 4, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; Byte[] primes = new Byte[4] { 2, 3, 5, 7 }; while (true) { LOOP: for (Int32 i = 4; i < 16; i++) key[i] = (Byte)Random.Shared.Next(0, 10); if (key.Skip(4).Any(x => x == 4)) continue; if (key.Distinct().Count() < 5) continue; if (key.Count(x => x == 8) < 3) continue; if (key.Count(x => primes.Contains(x)) < 2) continue; Int32 sum = key.Sum(x => x switch { 0 => -14, 1 => -12, 2 => -8, 3 => -7, 4 => -3, 5 => -1, 6 => 2, 7 => 4, 8 => 8, 9 => 9 }); if (55 <= sum && sum <= 110) continue; for (Int32 i = 0; i < 82; i++) sum = (sum + i) % 110; if (sum < 55) continue; for (Int32 i = 4; i <= 12; i += 4) for (Int32 j = 0; j < 3; j++) if (key[i + j] == key[i + j + 1]) goto LOOP; break; } return key.Aggregate("", (a, b) => $"{a}{b}", s => s.Insert(12, "-").Insert(8, "-").Insert(4, "-")); }