Skip to content

Instantly share code, notes, and snippets.

@yetanotherchris
Last active December 12, 2015 08:48
Show Gist options
  • Save yetanotherchris/4746446 to your computer and use it in GitHub Desktop.
Save yetanotherchris/4746446 to your computer and use it in GitHub Desktop.
Unique identifiers: Base64
private static Random _random = new Random();
public static string Base64Hash()
{
byte[] buffer = GetRandom(4);
return Convert.ToBase64String(buffer);
}
// <summary>
// This is used by all Unique identifier examples
// </summary>
public static byte[] GetRandom(int size)
{
byte[] buffer = new byte[size];
_random.NextBytes(buffer);
return buffer;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment