title: How to cast long unsigned to unsigned char*?
body: <p>I am trying to hash an <code>unsigned long</code> value, but the hash function takes an <code>unsigned char *</code>, as seen in the implementation below:</p>
  
  <pre><code>unsigned long djb2(unsigned char *key, int n)
  {
      unsigned long hash = 5381;
      int i = 0;
      while (i &lt; n-8) {
          hash = hash * 33 + key[i++];
          hash = hash * 33 + key[i++];
          hash = hash * 33 + key[i++];
          hash = hash * 33 + key[i++];
          hash = hash * 33 + key[i++];
          hash = hash * 33 + key[i++];
          hash = hash * 33 + key[i++];
          hash = hash * 33 + key[i++];
      }
      while (i &lt; n)
          hash = hash * 33 + key[i++];
      return hash;
  }
  </code></pre>
  
  <p>Is there a way I can achieve my goal, perhaps with a cast between the two?</p>