Guest User

Untitled

a guest
Sep 2nd, 2025
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 KB | None | 0 0
  1.         public string SN()
  2.         {
  3.             string Serial = RandomString(27, "23456789ABCDEFGHJKLMNPQRSTUVWXYZ");
  4.  
  5.             uint num = SerialBase.FromBase32(Serial.Substring(6, 2) + Serial.Substring(23, 2));
  6.  
  7.             Serial = Serial.Remove(14, 3);
  8.             Serial = Serial.Insert(14, SerialBase.ToBase32(num, 3, 3));
  9.             Serial = Serial.Remove(2, 2);
  10.             Serial = Serial.Insert(2, SerialBase.ToBase32((uint)SerialBase.GetKeyValue(num, 27, 5, 190), 2, 2));
  11.             Serial = Serial.Remove(12, 2);
  12.             Serial = Serial.Insert(12, SerialBase.ToBase32((uint)SerialBase.GetKeyValue(num, 6, 114, 79), 2, 2));
  13.             Serial = Serial.Remove(25, 2);
  14.             Serial = Serial.Insert(25, SerialBase.ToBase32((uint)SerialBase.GetKeyValue(num, 39, 82, 86), 2, 2));
  15.             Serial = Serial + SerialSystem.SerialBase.GetChecksum(Serial);
  16.             return Serial;
  17.         }
  18.  
  19.  
  20.         private readonly Random _rng = new Random();
  21.  
  22.         private string RandomString(int size, string _chars)
  23.  
  24.         {
  25.  
  26.             int _charslen = _chars.Length;
  27.  
  28.             char[] buffer = new char[size];
  29.  
  30.             for (int i = 0; i < size; i++)
  31.  
  32.             {
  33.  
  34.                 buffer[i] = _chars[_rng.Next(_charslen)];
  35.  
  36.             }
  37.  
  38.             return new string(buffer);
  39.  
  40.         }
Advertisement
Add Comment
Please, Sign In to add comment