I understood that web3.eth.sign(...)
will add “\x19Ethereum Signed Message” prefix to a message and hash with keccak256. Is there anyway to remove the prefix before signing? Or any library I can use to do a simple signing without prefix?
Signature without Prefix – Sign Without \u201C\x19Ethereum Signed Message\u201D Prefix
go-ethereumjavascriptsignatureweb3js
Best Answer
ethereumjs-util has the
hashPersonalMessage
method which adds the prefix and signs it.You can look at the codebase and see how this is implemented:
It is fairly apparent how you can modify this code snippet to not prepend the prefix :)