Skip to content

Instantly share code, notes, and snippets.

@danielts86
Created March 13, 2018 15:55
Show Gist options
  • Save danielts86/7bc729c00ebbb27f98d460b69eabd6e9 to your computer and use it in GitHub Desktop.
Save danielts86/7bc729c00ebbb27f98d460b69eabd6e9 to your computer and use it in GitHub Desktop.
Hash by SHA1
byte[] HashSHA1(string phrase)
{
if (phrase == null)
return null;
var encoder = new UTF8Encoding();
var sha1Hasher = new SHA1CryptoServiceProvider();
var hashedDataBytes = sha1Hasher.ComputeHash(encoder.GetBytes(phrase));
return hashedDataBytes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment