Skip to main content
1 of 2
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60

###user.email_hash

the UserDatabase sample provides a means to maintain a local user database and as described you may filter this dataset by user.email_hash to locate a user by email.

Here is a C# method to properly construct the email_hash which may be used to filter User records as well as constructing a Gravatar image.

// using System.Security.Cryptography;

public static string CalculateEmailHash(string email)
{
    return string.Join("",
        MD5
        .Create()
        .ComputeHash(Encoding.ASCII.GetBytes(email.ToLower()))
        .Select(v => v.ToString("x2")).ToArray());
}
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60