Hey,

I am trying to translate a C++ implementation of the DJB Hash function into C.

Here is the original:

would the following code in C work, I'm confused about a few features...Code:unsigned int DJBHash(const std::string& str) { unsigned int hash = 5381; for(std::size_t i = 0; i < str.length(); i++) { hash = ((hash << 5) + hash) + str[i]; } return (hash & 0x7FFFFFFF); }

My main confusion is the "<<" operator. ThanksCode:unsigned int DJBHash(unsigned char *str) { unsigned int hash = 5381; for(unsigned int i = 0; i < strlen(str); i++) { hash = ((hash << 5) + hash) + str[i]; } return (hash & 0x7FFFFFFF); }