Created
July 1, 2017 14:22
-
-
Save PradeepLoganathan/0988ecae3a4a073ba4420fb15244fd4c to your computer and use it in GitHub Desktop.
Creating hashes in .Net Core.
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
private void button1_Click(object sender, EventArgs e) | |
{ | |
byte[] digest; | |
string base64digest; | |
MD5 md5 = new MD5CryptoServiceProvider(); | |
digest = md5.ComputeHash(Encoding.UTF8.GetBytes(textBox1.Text)); | |
base64digest = Convert.ToBase64String(digest, 0, digest.Length); | |
textBox3.Text = base64digest; | |
SHA256 sha256 = SHA256.Create(); | |
digest = sha256.ComputeHash(Encoding.UTF8.GetBytes(textBox1.Text)); | |
base64digest = Convert.ToBase64String(digest, 0, digest.Length); | |
textBox2.Text = base64digest; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment