Test a hash function