Skip to content

Instantly share code, notes, and snippets.

@ayende
Created April 16, 2020 07:16
Show Gist options
  • Save ayende/3085dde271c045fa88bdde8a1dfeec9c to your computer and use it in GitHub Desktop.
Save ayende/3085dde271c045fa88bdde8a1dfeec9c to your computer and use it in GitHub Desktop.
static ushort GetShardId(string key)
{
using var md5 = MD5.Create();
{
var hash = md5.ComputeHash(Encoding.UTF8.GetBytes(key));
return BitConverter.ToUInt16(hash, 14);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment