How can I represent the this string "\x19Ethereum Signed Message:\n32" in java? The first character seems the length of 'Ethereum Signed Message:\n' string but it is escaped.

What I'm trying to do is to get the same sha3 hash for a given string using web3.sha3() and Web3j Hash.sha3() with the above prefix.

1 Answer 1


You can represent that in Java as "\u0019Ethereum Signed Message:\n32".

And I think I was trying to do the same thing as you are with handling web3 signed messages in web3j, you can see how I got that working here: https://github.com/web3j/web3j/issues/222

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.