title: Hash string with SHA256 key
body: <p>I can't get the correct HASH and I really have no idea what is wrong with it.
  All hashes I get aren't correct as on this site: <a href="http://hash.online-convert.com/sha256-generator" rel="nofollow noreferrer">http://hash.online-convert.com/sha256-generator</a></p>
  <pre><code>public NavigatedPage ()
  {
      string bytes = &quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;utf-8\&quot; ?&gt;&lt;Command&gt;  &lt;LMI_PAYMENT_NO&gt;1000&lt;/LMI_PAYMENT_NO&gt;&lt;LMI_MERCHANT_ID&gt;2096&lt;/LMI_MERCHANT_ID&gt;  &lt;LMI_HASH&gt;&lt;/LMI_HASH&gt;  &lt;LMI_PAYMENT_SYSTEM&gt;18&lt;/LMI_PAYMENT_SYSTEM&gt;  &lt;LMI_PAYMENT_AMOUNT&gt;1001&lt;/LMI_PAYMENT_AMOUNT&gt;  &lt;LMI_PAYMENT_DESC&gt;Оплата договора&lt;/LMI_PAYMENT_DESC&gt;&lt;/Command&gt;&quot;;
      string key = &quot;14653285&quot;;
      string message = bytes;//xml document in a string
      
      System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
      
      byte[] keyByte = encoding.GetBytes(key);
      
      HMACSHA256 hmacsha256 = new HMACSHA256(keyByte);
      
      byte[] messageBytes = encoding.GetBytes(message);
      
      byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);
      
      var tempHash = ByteToString(hashmessage);
  }
  
  public static string ByteToString(byte[] buff)
  {
      string sbinary = &quot;&quot;;
  
      for ( int i = 0; i &lt; buff.Length; i++ )
      {
          sbinary += buff[ i ].ToString(&quot;X2&quot;); // hex format
      }
      return ( sbinary );
  }
  </code></pre>
  <p>That's what i've done, but it gives me wrong result.</p>