0

I have this code to encrypt password with md5 and SALT in C#

var encoder = new UTF8Encoding();
var hashedBytes = new MD5CryptoServiceProvider().ComputeHash( encoder.GetBytes( salt + password ) );
return Convert.ToBase64String( hashedBytes );

Now, I want to use same encryption in php but don't know how to do it?

Can anyone help me on this issue?

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
DVM
  • 1
  • 1
  • 3
    Don't use `md5()` for password hashing. It's very insecure. Use PHP's [`password_hash()`](http://php.net/manual/en/function.password-hash.php) and [`password_verify()`](http://php.net/manual/en/function.password-verify.php) instead. If you're running a PHP version lower than 5.5 (which I _really_ hope you aren't), you can use the [password_compat library](https://github.com/ircmaxell/password_compat) to get the same functionallity. – M. Eriksson Mar 06 '17 at 07:17
  • 1
    i usually use bcrypt, but the problem is my client already have records with encryption in C# that i provided in question – DVM Mar 06 '17 at 07:26
  • Install CryptSharp using NuGet package manager then check [this](http://stackoverflow.com/questions/22615648/looking-for-c-sharp-equivalent-of-phps-password-verify) out. – ikibiki Apr 27 '17 at 01:01

0 Answers0