Upstream: generic hash module.