I'm using the ECVerify library and in the test examples in that contract, function ecverify(bytes32 hash, bytes sig, address signer) returns (bool) {}
expects bytes sig
in the format "\xFF\xFF\xFF..."
, and it does not seem to work with a bytes sig = "0xFFFFFF..."
format.
How do I convert bytes32 sig = 0xaca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf200
to bytes sig = "\xac\xa7\xda...
?
Update: re: Edmund Edgars comment, in ECVerfiy.sol there are test examples,
function test_v0() returns (bool) {
bytes32 hash = 0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad;
bytes memory sig = "\xac\xa7\xda\x99\x7a\xd1\x77\xf0\x40\x24\x0c\xdc\xcf\x69\x05\xb7\x1a\xb1\x6b\x74\x43\x43\x88\xc3\xa7\x2f\x34\xfd\x25\xd6\x43\x93\x46\xb2\xba\xc2\x74\xff\x29\xb4\x8b\x3e\xa6\xe2\xd0\x4c\x13\x36\xea\xce\xaf\xda\x3c\x53\xab\x48\x3f\xc3\xff\x12\xfa\xc3\xeb\xf2\x00";
return ECVerify.ecverify(hash, sig, 0x0e5cb767cce09a7f3ca594df118aa519be5e2b5a);
}
If I replace bytes sig
with "0xaca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf200"
then it fails. It seems to only work with the bytes sig = "\xac\xa7\xda..."
format.
I'm using ECVerify for a dApp and will be passing a lot of signatures to it, and it seemed like those need to be in that format, so are there any libraries or something for converting to "\xac\xa7\xda" or how would I send signatures to ECVerify?