title: Authentication from C# to MySQL CakePhp users
body: <p>I'm currently migrating a CakePhp app to ASP.NET. One thing that is blocking me at this point is that I'm unable to get the right hashing method to get the right password fit so users are able to sign-in from the ASP.NET app.</p>
  
  <p>I have the salt value that is set in config/core.php file.</p>
  
  <p>I've googled to try to determined where to find which hashing algorithm is used, and was not able to find the right query or no result.</p>
  
  <p>here is my C# method so far to hash the password.</p>
  
  <pre><code>public static string ToHash(this string password, string salt)
  {
    if (string.IsNullOrEmpty(password))
      return "";
  
    var provider = new SHA1CryptoServiceProvider();
    var encoding = new UnicodeEncoding();
    var bytes = provider.ComputeHash(encoding.GetBytes(salt + password));
    return Encoding.UTF8.GetString(bytes);
  }
  </code></pre>
  
  <p>I've tried to put the salt before or after the password, it's currently no matching at all, here is the hash password from the cakephp mysql database:</p>
  
  <p>c7fb60ef77dbe3d1681a68e6741ee3a23cc1f41d</p>
  
  <p>Here is what I have from my method</p>
  
  <p>��3[v"���1�:�ѐ��</p>
  
  <p>Not really sure where/how to solve this problem. Any help or hint would be appreciated.</p>
  
  <p>Thanks</p>