jweinst1
2/8/2019 - 7:59 PM

new hash algorithm, chop chop C

new hash algorithm, chop chop C

#include "chop_chop_hash.h"

unsigned chop_chop_hash(const char* text)
{
	unsigned chop_word = CHOP_HASH_START_32B;
	int state = 0;
	while(*text) {
		chop_word = chop_word ^ ((*text++) << state);
		state += (state == 24 ? -24 : 8);
	}
	return chop_word;
}