validate_hash method added