Add sanity check for wrong uses of check_hash