title: Implement non-cryptographic hash functions in C
body: <p>I was trying to implement hash table in C to store English words. So I was searching through the internet to some of the best non-cryptographic hash functions. Some of them are <strong>Murmurhash, Seahash, xxHash</strong> but they all seemed very difficult to implement. So I searched for some of the simpler ones then I found out about the <strong>DJB2, sdbm, lose lose</strong>. On implementing sdbm I got this</p>
  
  <pre><code>try.c:12:18: error: using the result of an assignment as a condition without 
  parentheses [-Werror,-Wparentheses]
      while (c = *str++)
             ~~^~~~~~~~
  try.c:12:18: note: place parentheses around the assignment to silence this 
  warning
      while (c = *str++)
               ^
             (         )
  try.c:12:18: note: use '==' to turn this assignment into an equality 
  comparison
      while (c = *str++)
               ^
               ==
  try.c:26:31: error: passing 'char *' to parameter of type 'unsigned char *' 
  converts between pointers to integer types with
    different sign [-Werror,-Wpointer-sign]
  unsigned long hash = sdbm(argv[1]);
                            ^~~~~~~
  2 errors generated. 
  </code></pre>
  
  <p>My code was</p>
  
  <pre><code>#include &lt;cs50.h&gt; 
  #include &lt;string.h&gt;
  #include &lt;stdio.h&gt;
  
  static unsigned long
  sdbm(str)
  unsigned char *str;
  {
      unsigned long hash = 0;
      int c;
  
      while (c = *str++)
          hash = c + (hash &lt;&lt; 6) + (hash &lt;&lt; 16) - hash;
  
      return hash;
  }
  
  int main(int argc,char *argv[])
  {
  if(argc!=2)
  {
      printf("Enter the second command line argument\n");
      return 1;
  }
  
  unsigned long hash = sdbm(argv[1]);
  printf("The returned hashcode is %lu\n", hash);
  }
  </code></pre>
  
  <p>If you can also help me with Murmurhash, Seahash or the xxHash, please do so.</p>