hash
This commit is contained in:
parent
9fe2baa187
commit
7c55f63ee6
@ -77,8 +77,8 @@ unsigned long __generate_hash(char* str) {
|
|||||||
unsigned long ret = 0;
|
unsigned long ret = 0;
|
||||||
size_t max = strlen(str);
|
size_t max = strlen(str);
|
||||||
while (pos < max) {
|
while (pos < max) {
|
||||||
ret += (unsigned char)str[pos];
|
ret += (unsigned char)str[pos] * pos;
|
||||||
if (ret > (unsigned long)ULONG_MAX - 10) ret = 32;
|
if (ret > (unsigned long)ULONG_MAX - 8) ret = 32;
|
||||||
pos ++;
|
pos ++;
|
||||||
}
|
}
|
||||||
if (ret == 0) ret ++;
|
if (ret == 0) ret ++;
|
||||||
@ -326,4 +326,4 @@ int parse_file_data(int argc, char** argv) {
|
|||||||
#undef true
|
#undef true
|
||||||
#undef false
|
#undef false
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user