Q:

DJBX33X hash function in C#

How would a DJBX33X hash function be implemented in C#?  The following is code for this function in C.
uint32_t hash(const char *arKey, uint32_t nKeyLength) 
{
    uint32_t hash = 5381;

    for (; nKeyLength > 0; nKeyLength -=1) 
    {
        hash = ((hash << 5) + hash) ^ *arKey++;
    }

    return hash;
}

UPDATED here is my code so far, but results from C and C# functions are different, did I missed something? 
public static long hash(string str)
{           
    long hash = 5381;

    for (int i = 0; i < str. Length; i++)
    {
        hash = ((hash << 5) + hash) ^ (int)str[i];
    }

    return hash;
}

UPDATED 2 the following are outpus of C and C#
C#

t = 116(<<172192+177573) -> 177617
t = 116(<<5683744+5861361) -> 5861253
u = 117(<<187560096+193421349) -> 193421392
U = 85(<<6189484544+6382905936) -> 6382905861
'ttuU' => '6382905861'

C

t = 116 (<<172192+177573) -> 177617
t = 116 (<<5683744+5861361) -> 5861253
u = 117 (<<187560096+193421349) -> 193421392
U = 85 (<<1894517248+2087938640) -> 2087938565
'ttuU' -> '2087938565'

A:

It's likely the data type is important for the hash implementation; you'd have to refer to documentation for an exact answer, but this function produces the results you're expecting:
public static uint Hash(string str)
{
    uint result = 5381;

    for (int i = 0; i < str. Length; i++)
    {
        result = ((result << 5) + result) ^ str[i];
    }

    return result;
}

Example output:
Hash("ttuU") -> 2087938565

