Posts MD5 Encryption in .Net and PHP

MD5 Encryption in .Net and PHP

To get MD5 hash in C# use this method. It returns same value AS MD5() function in PHP

public string GetMD5Hash(string input)
            System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
            byte[] bs = System.Text.Encoding.UTF8.GetBytes(input);
            bs = x.ComputeHash(bs);
            System.Text.StringBuilder s = new System.Text.StringBuilder();
            foreach (byte b in bs)
            string password = s.ToString();
            return password;

And this one is in PHP

These both will return the same value

This post is licensed under CC BY 4.0 by the author.