-
-
Save hatelove/92c92de6a6679aaae22ccf0aa948bb10 to your computer and use it in GitHub Desktop.
Sha256 sample code
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
public string GetHash(string plainText) | |
{ | |
var crypt = new System.Security.Cryptography.SHA256Managed(); | |
var hash = new StringBuilder(); | |
var crypto = crypt.ComputeHash(Encoding.UTF8.GetBytes(plainText)); | |
foreach (var theByte in crypto) | |
{ | |
hash.Append(theByte.ToString("x2")); | |
} | |
return hash.ToString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment