nblackburn
11/5/2017 - 11:59 AM

Hash

Calculates the hash of a string.

module.exports = data => {
	let hash = 0;

	for(let index = 0; index < data.length; index++) {
		hash = ((hash << 5) + hash) + data.charCodeAt(index) & 0xffffffff;
	}

	return hash;
};