如何在C语言中编写djb2哈希函数?

问题描述

我不知道如何在C上编写djb3哈希函数

搜索了互联网,但发现它可能是C ++语言。

unsigned long hash(unsigned char *str){
        unsigned long hash = 5381;
        int c;

        while (c = *str++)
            hash = ((hash << 5) + hash) + c; /* hash * 33 + c */

        return hash;
    }

如果您能向我解释这一点,我将非常感谢...

解决方法

这是C编程语言中djb2哈希函数的代码!

FormHelper::control()

感谢@ 500-InternalServerError解决了我的疑问。