1

This question already has an answer here:

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;
}
}

marked as duplicate by Ismael, Achala Dissanayake, Richard Horrocks, flygoing, ivicaa Feb 26 '18 at 5:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

Found it, the format is

["0x3a", "0x44", "0x3d", "0x83", "0x81", "0xa6", "0x79", "0x8a", "0x70", "0xc6", "0xff", "0x93", "0x04", "0xbd", "0xc8", "0xcb", "0x01", "0x63", "0xc2", "0x32", "0x11", "0xd1", "0x16", "0x28", "0xfa", "0xe5", "0x2e", "0xf9", "0xe0", "0xdc", "0xa1", "0x1a", "0x00", "0x1c", "0xf0", "0x66", "0xd5", "0x6a", "0x81", "0x56", "0xfc", "0x20", "0x1c", "0xd5", "0xdf", "0x8a", "0x36", "0xef", "0x69", "0x4e", "0xec", "0xd2", "0x58", "0x90", "0x3f", "0xca", "0x70", "0x86", "0xc1", "0xfa", "0xe7", "0x44", "0x1e", "0x1d"]

Was answered in this question, How to pass arbitrary bytes to a function in Remix

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