O
O
Oleg Yatsenko2014-09-19 19:55:21
Hashing
Oleg Yatsenko, 2014-09-19 19:55:21

How to translate c++ function to js?

Hey!
Please help translate c++ function to js.

unsigned int HashFAQ6(const char * str)
{

unsigned int hash = 0;

for (; *str; str++)
{
hash += (unsigned char)(*str);
hash += (hash << 10);
hash ^= (hash >> 6);
}
hash += (hash << 3);
hash ^= (hash >> 11);
hash += (hash << 15);

return hash;

}

Thank you!
PS Maybe someone will tell you. Is there a hash f-i, which receives an array of positive integers as input, and produces an integer hash as output?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Taratin, 2014-09-19
@Samber

jsfiddle.net/QW01_01/npqjpj12

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question