Implementation of hash algorithm converts string to number
<p>I have to implement hash table,
I got scheme that shows how to convert string to number (hash function):</p>

<pre><code>abcdef... -&gt; ((256*a+b) XOR (256*c+d)) XOR (256*e+f) ...
</code></pre>

<p>I'm writing this question, because I'm not sure if this code (mainly loops) works in a proper way.</p>

<pre><code>int hash(char *s){
    int len = strlen(s);
    int i, result = 0;
    for(i = 0; i &lt; len-1; i=i+2) {
            result ^= ((256*s[i])+s[i+1]);
    }
    if(s[i]!=0) {
            result ^= (256*s[i]);
    }
    return result;
}
</code></pre>