-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V in Signed Message Hash not being calculated properly #191
Comments
let web3 = Web3.InfuraRinkebyWeb3() try this |
Actually this seems like a bug in the library. It appears that it is not properly handling v in that signature. Instead of doing 27 + (r%2) it might be just applying the modulo. See the discussion here about how v is calculated. This would make sense why the signature is always 00 or 01 instead of 1b or 1c |
Hi, @DomAmato, @ashishonmobile . Thank you for this question, I'll fix it |
Hi! Sorry for waiting so long, was on my vacation. Made a fix that just a kludge for now. |
I have a python application that we were using to work with ethereum and now we are trying to do something similar on osx/ios. I wanted to test signing a string similar to how we were doing it but kept running into an issue where the last 2 characters of the signed message were different.
Here is the swift code:
Here is the python code:
I confirmed the sha3 hash is the same between them
58b105f41aa555ea93c3f91eeebac19de54cd71e528b3317e6c0bbd49aa8f5b1
But the signature comes back and is just ever so slightly different
Swift
5c2b257aaa8810ae7648c15d4361e4c3f080922b98cccfa7304db470ca7fddd16fd1b1d2a42ba4d65787bc3c1971ec728c34bd5baf88a226db17550c54d591b101
Python
5c2b257aaa8810ae7648c15d4361e4c3f080922b98cccfa7304db470ca7fddd16fd1b1d2a42ba4d65787bc3c1971ec728c34bd5baf88a226db17550c54d591b11c
Basically this library always ends the signature with
01
or00
and the python library ends it in1c
or1b
According to this discussion about how
v
is calculated it seems this library is not properly handling it in this instance.The text was updated successfully, but these errors were encountered: