誰能告訴我爲什麼數字5381用於DJB哈希函數?DJB哈希函數中5381數字的原因是什麼?
DJB哈希函數是
H(0)= 5381
H(1)= 33 * H(I-1)^ STR [1]
一個C程序:
unsigned int DJBHash(char* str, unsigned int len)
{
unsigned int hash = 5381;
unsigned int i = 0;
for(i = 0; i < len; str++, i++)
{
hash = ((hash << 5) + hash) + (*str);
}
return hash;
}
那些交換過的網址讓我大笑起來。 –
@高我很高興你的幽默:)幸運的是,交換URLs非常簡單,因爲我只需要切換數字。 –
我無法理解上述幽默。 –