using System.Security.Cryptography;
public static class ImageReference
public static void Main()
for (int i = 0; i < 100; i++)
Console.WriteLine(Generate());
public static string Generate(int length = 10)
var chars = "0123456789ABCDEF".ToCharArray();
if (256 % chars.Length != 0)
throw new Exception("Invalid chars length");
var randomBytes = new byte[length];
using (var crypto = new RNGCryptoServiceProvider())
crypto.GetBytes(randomBytes);
var result = new char[length];
for (int i = 0; i < length; i++)
int pos = randomBytes[i] % chars.Length;
return new string (result);