by
4,782 34
9
7
21k
23
Top 1% !
Popular
Famous
Pearl of Wisdom
Nice
Specified
Refined
Popularity: 118th place
Created
Modified Sep 15, 2013
This snippet is Public
No tags for this snippet yet.
.NETFramework4.0
Architecturex86_64
DBMSMS SQL Server
Extension.cs
InputName0password
InputType0string
LanguageCSharp
LicenseMIT_X11
MethodNameComputeMD5HashSQLServerCompliant
OSWindows
OutputTypestring
Windows VersionWindows7

Compute MD5 Hash in C#

Returns an hash (computed with MD5 algorithm) of the given string.
Note: this is compliant with the results given by HashBytes('MD5', @text) method of SQL Server.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/11194/Compute-MD5-Hash-in-C-?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
public static string ComputeMD5HashSQLServerCompliant(this string password) { System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); byte[] binaryInput = Encoding.Unicode.GetBytes(password); byte[] hashOfInput = md5.ComputeHash(binaryInput); return hashOfInput.PrintHexByteArray(); }

Other Steps and Solutions

If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus