Hash functions implementation