Skip to content

Instantly share code, notes, and snippets.

@bkono
Created June 9, 2010 19:13
Show Gist options
  • Save bkono/432016 to your computer and use it in GitHub Desktop.
Save bkono/432016 to your computer and use it in GitHub Desktop.
static void Main(string[] args)
{
for (int i = 0; i < 10; i++)
{
var token =
BitConverter.ToString(SHA1.Create().ComputeHash(Encoding.ASCII.GetBytes(Guid.NewGuid().ToString())))
.Replace("-", "").Substring(8, 12).ToLower();
Console.WriteLine(token);
}
Console.ReadLine();
for (int i = 0; i < 10; i++)
{
var token2 = DateTime.Now.Ticks.ToString("x");
Console.WriteLine(token2); // 8c8113da982d75a
}
Console.ReadLine();
var token3 = Convert.ToBase64String(Guid.NewGuid().ToByteArray(), 0, 12);
Console.WriteLine(token3);
Console.ReadLine();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment