hashMessage should have an optional parameter that can process hex like string #592
Unanswered
script-money
asked this question in
Idea / Feature Request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I was using viem to generate signatures on the server side, I found that they were inconsistent with those generated in Solidity, causing the signatures to not be verified. After investigation, it was discovered that the length calculation for the string passed to hashMessage was different from that used in Solidity.
In ECDSA.sol,
In viem
If the string is in hex format and the lengths of strings
toBytes(hexString).length
andstringToBytes(hexString).length
are not the same, this may result in the inability to generate the same signature with viem as in Solidity.I found a commit 64a2f51 changed "toBytes" method to "stringToBytes" recently.
I suggest to add optional parameters to handle the hexstring with the original "toBytes" method to adapt to different situations.
Beta Was this translation helpful? Give feedback.
All reactions