To pass a long byte array,
"\x3a\x44\x3d\x83\x81\xa6\x79\x8a\x70\xc6\xff\x93\x04\xbd\xc8\xcb\x01\x63\xc2\x32\x11\xd1\x16\x28\xfa\xe5\x2e\xf9\xe0\xdc\xa1\x1a\x00\x1c\xf0\x66\xd5\x6a\x81\x56\xfc\x20\x1c\xd5\xdf\x8a\x36\xef\x69\x4e\xec\xd2\x58\x90\x3f\xca\x70\x86\xc1\xfa\xe7\x44\x1e\x1d"
as a function argument
contract messageHash {
function hashPersonalMessage(bytes _message) returns (bytes32){
bytes32 msgHash = sha3('\x19Ethereum Signed Message:\n64', _message);
return msgHash;
}
does not work for me in the Remix IDE
If the byte array is hard-coded in the contract, then it works,
contract messageHash {
function hashPersonalMessage() returns (bytes32){
bytes32 msgHash = sha3('\x19Ethereum Signed Message:\n64', hex"3a443d8381a6798a70c6ff9304bdc8cb0163c23211d11628fae52ef9e0dca11a001cf066d56a8156fc201cd5df8a36ef694eecd258903fca7086c1fae7441e1d");
return msgHash;
}
}
outputs b08ec7b042251c745afe4b25e62edcc014a50fae0535d9ee340dd4e2b9c2fd89
, a msgHash of the correct format (it gets verified with ECverify)
and this works as well,
contract messageHash {
function hashPersonalMessage() returns (bytes32){
bytes32 msgHash = sha3('\x19Ethereum Signed Message:\n64', "\x3a\x44\x3d\x83\x81\xa6\x79\x8a\x70\xc6\xff\x93\x04\xbd\xc8\xcb\x01\x63\xc2\x32\x11\xd1\x16\x28\xfa\xe5\x2e\xf9\xe0\xdc\xa1\x1a\x00\x1c\xf0\x66\xd5\x6a\x81\x56\xfc\x20\x1c\xd5\xdf\x8a\x36\xef\x69\x4e\xec\xd2\x58\x90\x3f\xca\x70\x86\xc1\xfa\xe7\x44\x1e\x1d");
return msgHash;
}
}