The algorithm is basically an improvement on the good old:
int hash(char *x) { int ret=0; while(*x) { ret+=ret<<5 + *x; x++; } }
The primary improvements are:
1) only hash the beginning of the string (and the length of the string) 2) dynamically calculate how much of the string needs to be hashed for to avoid hash duplicates 3) Replace "5" with different numbers for different characters in the string.
Not sure what you mean by "complexeties", but the string handling in Pike is linear except in the most extreme circumstances. As far as rationale goes: There is a reason for everything in Pike :)