improve test coverage for hash.valid()