title: Xamarin PCLCrypto SHA256 give different hash
body: <p>I have a project in Xamarin Forms XAML portable. i need to get a SHA256 from a string. I use the PCLCrypto for finding my hash, because System.Security.Cryptography doesn't exist in PCL.</p>
  
  <p>I get a sha256 from an API to compare the values. This is the method I use to get the SHA256 hash:</p>
  
  <pre><code>private string getSha256(string data) {
              byte[] byteData = Encoding.UTF8.GetBytes(data);
              var hasher = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha256);
              byte[] hash = hasher.HashData(byteData);
              string hashBase64 = Convert.ToBase64String(hash);
              return hashBase64;
          }
  </code></pre>
  
  <p>The string I use is 'secret'. I use this to check it:</p>
  
  <p><a href="http://www.xorbin.com/tools/sha256-hash-calculator" rel="nofollow noreferrer">http://www.xorbin.com/tools/sha256-hash-calculator</a>
  and it gives:</p>
  
  <pre><code>2bb80d537b1da3e38bd30361aa855686bde0eacd7162fef6a25fe97bf527a25b
  </code></pre>
  
  <p>But I'm getting two different hash codes:</p>
  
  <p>API hash:
      2bb80d537b1da3e38bd30361aa855686bde0eacd7162fef6a25fe97bf527a25b</p>
  
  <p>PCLCrypto hash I generated:
      K7gNU3sdo+OL0wNhqoVWhr3g6s1xYv72ol/pe/Unols=</p>
  
  <p>Its the same string 'secret' but is resulting in different hashes. I also noticed PCLCrypto hash always ends with '='. </p>
  
  <p>Why are they different?</p>