title: Keccak SHA-3-512: Missed a detail
body: <p>I just want to use SHA-3-512. So I used the <a href="https://github.com/gvanas/KeccakCodePackage" rel="nofollow noreferrer">KeccakCodePackage</a>.</p>
  
  <p>I read the <a href="https://keccak.team/keccak_specs_summary.html" rel="nofollow noreferrer">specification</a> and used them.To check my result I use the following <a href="https://emn178.github.io/online-tools/sha3_512.html" rel="nofollow noreferrer">Online-Hash-Website</a>. </p>
  
  <p>My result for "Some Data" is:</p>
  
  <blockquote>
    <p>15d7fb5fcb81cf8f178cd9ea946c298db9d6b3d3509a35d369fc58cbc923fab549df95dffddb371a5ef21745b3bf7f7a15ee7785a0ee81b97e9d87911e</p>
  </blockquote>
  
  <p>While the Online-Converter returns the following:</p>
  
  <blockquote>
    <p>15d7fb5fcb081cf80f178cd9ea946c298db9d6b3d3509a35d369fc58cbc923fab549df95dffd0db371a5ef210745b30b0f7f7a15ee7785a0ee81b97e9d87911e</p>
  </blockquote>
  
  <p>I used the following configuration:</p>
  
  <pre><code>char* inputData = (char*)malloc(sizeof(char) * 15);
  char* outputData = (char*)malloc(sizeof(char) * 1024);
  
  inputData = "Some Data";
  unsigned int rate = 576;
  unsigned int capacity = 1024;
  unsigned char suffix = 0x06;
  unsigned int hashLength = 64;
  
  int spongeResult = KeccakWidth1600_Sponge(rate, capacity , inputData, sizeof(inputData)+1, suffix , outputData, hashLength);
  </code></pre>
  
  <p>The complete code can be found <a href="https://pastebin.com/1fyJj52p" rel="nofollow noreferrer">here</a>.</p>
  
  <p>The code that prints the value is:</p>
  
  <pre><code>    int i;
      for(i = 0; i &lt; hashLength; i++){
          printf("%x", *(outputData + i) &amp; 0xff);
      }
  </code></pre>
  
  <p>I realized that there are more zeros within the other hash. So, my question: What is wrong in my code?</p>
  
  <p>EDIT: Here's the entire program:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include "KeccakCodePackage/bin/generic64/libkeccak.a.headers/KeccakSpongeWidth1600.h"
  
  void main(){
      printf("%s\n", "Run Keccak Test");
      char* inputData = (char*)malloc(sizeof(char) * 15);
      char* outputData = (char*)malloc(sizeof(char) * 1024);
  
  
      inputData = "Some Data";
      unsigned int rate = 576;
      unsigned int capacity = 1024;
      unsigned char suffix = 0x06;
      unsigned int hashLength = 64;
  
      printf("%s", "Hash the following data: \n");
      printf("%s\n", inputData);
  
      int spongeResult = KeccakWidth1600_Sponge(rate, capacity , inputData, sizeof(inputData)+1, suffix , outputData, hashLength);
  
      if(spongeResult == 1){
          printf("%s", "Sponge was not successful\n");
      }else{
          printf("%s", "Sponge successful\n");
  
          int i;
          for(i = 0; i &lt; hashLength; i++){
              printf("%x", *(outputData + i) &amp; 0xff);
          }
      }
  
      printf("%s", "\nFinished Keccak test.\n");
  }
  </code></pre>