Created
June 4, 2015 02:14
-
-
Save ianldgs/04718293b9a07e67b6ec to your computer and use it in GitHub Desktop.
Encriptografa uma string em sha1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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