Skip to content

Instantly share code, notes, and snippets.

View Zaydiscool777's full-sized avatar
:bowtie:
Waiting for something to do

zaydm Zaydiscool777

:bowtie:
Waiting for something to do
View GitHub Profile
@hmic
hmic / hash.h
Created January 25, 2012 14:03
php hash function "from the source"
/*
* DJBX33A (Daniel J. Bernstein, Times 33 with Addition)
*
* This is Daniel J. Bernstein's popular `times 33' hash function as
* posted by him years ago on comp.lang.c. It basically uses a function
* like ``hash(i) = hash(i-1) * 33 + str[i]''. This is one of the best
* known hash functions for strings. Because it is both computed very
* fast and distributes very well.
*
* The magic of number 33, i.e. why it works better than many other