C hash implementation