title: Replicate C# code hash to PHP
body: <p>I have to replicate C# hash from the code below into PHP. I have been searching but didn't find a solution so far.</p>
  
  <pre class="lang-cs prettyprint-override"><code>private string createHash(string stringToHash)
      {
          // Byte[] originalBytes;
  
          MD5 hash = MD5.Create();
  
          hash = new MD5CryptoServiceProvider();
  
          // originalBytes = ASCIIEncoding.Default.GetBytes(stringToHash);
  
          byte[] data = hash.ComputeHash(Encoding.Default.GetBytes(stringToHash));
  
          StringBuilder sBuilder = new StringBuilder();
  
          for (int i = 0; i &lt; data.Length; i++)
          {
  
              sBuilder.Append(data[i].ToString("x2"));
  
          }
  
          return sBuilder.ToString();
      }
  </code></pre>
  
  <p>Thanx for you help!</p>