Skip to content

Instantly share code, notes, and snippets.

@akhansari
Last active July 27, 2023 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akhansari/10023621 to your computer and use it in GitHub Desktop.
Save akhansari/10023621 to your computer and use it in GitHub Desktop.
Generating a Hash from a string.
public string Hash(string str)
{
return string.Join("", System.Security.Cryptography.SHA256.Create()
.ComputeHash(System.Text.Encoding.UTF8.GetBytes(str)).Select(s => s.ToString("x2")));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment