Check existing issues
Viem Version
2.48.1
Current Behavior
'isHex' accepts odd numbered nibbles, even in the strict mode, isHex("0x1") === true.
Expected Behavior
'isHex' rejects odd numbered nibbles in the scrict mode, isHex(0x1) === false.
Steps To Reproduce
No response
Link to Minimal Reproducible Example
No response
Anything else?
It really doesn't make sense to accept odd-length hex values.
Everything around EVM works with full bytes and never with half-bytes. I'm not aware of any API or tool that would accept odd-length hex values, they all reject such hex strings as malformed with the risk of weirder ones silently corrupting data by "fixing" the parity. There's no use case for handling odd-length hex values, but there are risks in accepting them as valid.
Check existing issues
Viem Version
2.48.1
Current Behavior
'isHex' accepts odd numbered nibbles, even in the strict mode,
isHex("0x1") === true.Expected Behavior
'isHex' rejects odd numbered nibbles in the scrict mode,
isHex(0x1) === false.Steps To Reproduce
No response
Link to Minimal Reproducible Example
No response
Anything else?
It really doesn't make sense to accept odd-length hex values.
Everything around EVM works with full bytes and never with half-bytes. I'm not aware of any API or tool that would accept odd-length hex values, they all reject such hex strings as malformed with the risk of weirder ones silently corrupting data by "fixing" the parity. There's no use case for handling odd-length hex values, but there are risks in accepting them as valid.