Oct 27, 2022

ASP.NET Core MVC MD5 Hashing is equal with online MD5 generator

 Reproduced in my local and it's getting the same value with the online Hash Generator.


public static string GetMd5HashNewMethod(string inputNew)
        {
            using (System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create())
            {
                // inputNew = "Palnati"
                byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(inputNew);
                byte[] hashBytes = md5.ComputeHash(inputBytes);

                return Convert.ToHexString(hashBytes); // .NET 5 +
             // return Convert.ToBase64String(hashBytes);
                
            }
        }

Output from Code & Online:
7b1ea3d03dafd1626817916e13a207e1

7b1ea3d03dafd1626817916e13a207e1

We have to use .ToHexString() from .NET 5+

You can refer my post in Stack Overflow.

===========================================================================

Browse online Amazon shopping from the below links which are recently tried by me.

Super in Quality.