private static byte[] XorBytes(byte[] byte1, byte[] byte2, bool inverse = false)
if (byte1.Length != byte2.Length)
throw new ArgumentException($"Cannot XOR Both Byte Arrays of Different Length(s): {byte1.Length} & {byte2.Length} Byte(s).");
for (int i = 0; i < byte2.Length; i++)
byte2[i] = (byte)(~byte2[i] & 0xFF);
byte[] result = new byte[byte1.Length];
for (int i = 0; i < byte1.Length; i++)
result[i] = (byte)(byte1[i] ^ byte2[i]);
private static string GenerateIPKey()
const string charsJunk = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
StringBuilder sb = new StringBuilder(32);
for (int i = 0; i < sb.Length; i++)
sb.Append(charsJunk[rng.Next(charsJunk.Length)]);
public static void Main(string[] args)
Console.WriteLine(GenerateIPKey());