Skip to content

Instantly share code, notes, and snippets.

@ianldgs
Created June 4, 2015 02:14
Show Gist options
  • Save ianldgs/04718293b9a07e67b6ec to your computer and use it in GitHub Desktop.
Save ianldgs/04718293b9a07e67b6ec to your computer and use it in GitHub Desktop.
Encriptografa uma string em sha1
using System.Security.Cryptography;
string hash(string str)
{
try
{
SHA1 sha1 = SHA1.Create();
byte[] hashData = sha1.ComputeHash(Encoding.UTF8.GetBytes(str));
return BitConverter.ToString(hashData).Replace("-", "").ToLower();
}
catch (Exception e)
{
throw e;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment