Hi. I have some doubts regarding hash computation in remix IDE. For signing a message in Ethereum, first, the hash of the message is computed. on the hash, signing is done. This is fine.
What I really don't understand is that, how does remix ide compute the message hash? After going through some resources, I found that remix computes the hash value of the message's by prepending a string and then the message.. and that is \x19Ethereum Signed Message:\n32and followed by the keccak256 hash of the message. That is what I have understood.
Say I want to sign a message "hello". So first the hash will be created in this way .. First> x <-- keccak256("hello"); then second hash <-- keccak256("\x19Ethereum Signed Message:\n32"||x);This is the final hash value on which signing will be done. unfortunately, the computed hash value in this way does not match what Remix gives at the run section(in Remix VM mode signing from some account), But! the signature is correct, it can pass the ethereum errecover(), so why plz help.
and i know that hash is computed by ethereum.util.hashPersonalMessage(), if so, it should be same......
Hi. I have some doubts regarding hash computation in remix IDE. For signing a message in Ethereum, first, the hash of the message is computed. on the hash, signing is done. This is fine.
What I really don't understand is that, how does remix ide compute the message hash? After going through some resources, I found that remix computes the hash value of the message's by prepending a string and then the message.. and that is
\x19Ethereum Signed Message:\n32
and followed by the keccak256 hash of the message. That is what I have understood.Say I want to sign a message "hello". So first the hash will be created in this way .. First> x <-- keccak256("hello"); then second hash <-- keccak256("\x19Ethereum Signed Message:\n32"||x);This is the final hash value on which signing will be done. unfortunately, the computed hash value in this way does not match what Remix gives at the run section(in Remix VM mode signing from some account), But! the signature is correct, it can pass the ethereum
errecover()
, so why plz help.and i know that hash is computed by
ethereum.util.hashPersonalMessage()
, if so, it should be same......