Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string SN()
- {
- string Serial = RandomString(27, "23456789ABCDEFGHJKLMNPQRSTUVWXYZ");
- uint num = SerialBase.FromBase32(Serial.Substring(6, 2) + Serial.Substring(23, 2));
- Serial = Serial.Remove(14, 3);
- Serial = Serial.Insert(14, SerialBase.ToBase32(num, 3, 3));
- Serial = Serial.Remove(2, 2);
- Serial = Serial.Insert(2, SerialBase.ToBase32((uint)SerialBase.GetKeyValue(num, 27, 5, 190), 2, 2));
- Serial = Serial.Remove(12, 2);
- Serial = Serial.Insert(12, SerialBase.ToBase32((uint)SerialBase.GetKeyValue(num, 6, 114, 79), 2, 2));
- Serial = Serial.Remove(25, 2);
- Serial = Serial.Insert(25, SerialBase.ToBase32((uint)SerialBase.GetKeyValue(num, 39, 82, 86), 2, 2));
- Serial = Serial + SerialSystem.SerialBase.GetChecksum(Serial);
- return Serial;
- }
- private readonly Random _rng = new Random();
- private string RandomString(int size, string _chars)
- {
- int _charslen = _chars.Length;
- char[] buffer = new char[size];
- for (int i = 0; i < size; i++)
- {
- buffer[i] = _chars[_rng.Next(_charslen)];
- }
- return new string(buffer);
- }
Advertisement
Add Comment
Please, Sign In to add comment