Skip to content

Instantly share code, notes, and snippets.

@indy-singh
Created June 14, 2023 19:37
Show Gist options
  • Save indy-singh/5d0ab11ad099d5855bc1544985bd605e to your computer and use it in GitHub Desktop.
Save indy-singh/5d0ab11ad099d5855bc1544985bd605e to your computer and use it in GitHub Desktop.
public static void Main(string[] args)
{
var murmurHash32 = new MurmurHash32();
var dict = new Dictionary<int, List<string>>();
while (true)
{
var s = Guid.NewGuid().ToString();
var bytes = Encoding.UTF8.GetBytes(s);
var computeHash = murmurHash32.ComputeHash(bytes);
var int32 = BitConverter.ToInt32(computeHash);
if (dict.ContainsKey(int32) is false)
{
dict[int32] = new List<string>();
}
dict[int32].Add(s);
if (dict[int32].Count > 1)
{
Console.WriteLine(string.Join(",", dict[int32]));
}
}
}
@indy-singh
Copy link
Author

public static void Main(string[] args)
        {
            var murmurHash32 = new MurmurHash32();

            while (true)
            {
                var s = Guid.NewGuid().ToString();
                var bytes = Encoding.ASCII.GetBytes(s);
                var computeHash = murmurHash32.ComputeHash(bytes);
                var int32 = BitConverter.ToInt32(computeHash);

                if (int32 == 1228476406)
                {
                    Console.WriteLine(s);
                }
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment