title: Simple implementation of SHA-3 Keccak hashing to the wrong output in C#?
body: <p>I am trying to get the HashLib library @ <a href="https://hashlib.codeplex.com/" rel="nofollow noreferrer">https://hashlib.codeplex.com/</a> working for the new SHA-3 Keccak algorithm. I've written a simple Console application that supposedly has to output the correct hash code, but it doesn't!</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.IO;
  using System.Diagnostics;
  using HashLib;
  using System.Threading.Tasks;
  
  namespace ConsoleApplication5
  {
      class Program
      {
          static void Main(string[] args)
          {
              {
                  string passPhrase = &quot;&quot;;
                  IHash hash = HashFactory.Crypto.SHA3.CreateKeccak512();
                  HashResult r = hash.ComputeString(passPhrase, System.Text.Encoding.ASCII);
              
                  Console.WriteLine(r.ToString().ToLower().Replace(&quot;-&quot;,&quot;&quot;));
                  Console.WriteLine(&quot;{0}, {1}, {2}&quot;, hash.BlockSize, hash.HashSize, hash.Name);
                  Console.ReadLine();
              }
          }
      }
  }
  </code></pre>
  <p>The application builds and runs ok, but the output is very wrong. When I use other people 's implementations of the Keccak algorithm, I get different results and it doesn't match for example this wiki post either. <a href="https://en.wikipedia.org/wiki/SHA-3" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/SHA-3</a> So something is obviously wrong.</p>
  <p>When I leave the text empty, as per example, I get the following: &quot;df987cfd23fbc92e7e87faaca300ec3f etc. etc.&quot; while the wiki and other tools say I should get</p>
  <p>&quot;0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e&quot;</p>
  <p>,which is something entirely different. I also tried it with non-empty strings of course.</p>
  <p>Does anyone have a suggestion?</p>