Assume you have a string of hex data you want to hash.
In Ethers:
ethers.utils.keccak256("0x1234");
// "0x56570de287d73cd1cb6092bb8fdee6173974955fdef345ae579ee9f475ea7432"
In Solidity:
function hasher() external pure returns(bytes32) {
return keccak256('1234');
}
// "0x387a8233c96e1fc0ad5e284353276177af2186e7afa85296f106336e376669f7"
function hasher() external pure returns(bytes32) {
return keccak256('0x1234');
}
// "0x1ac7d1b81b7ba1025b36ccb86723da6ee5a87259f1c2fd5abe69d3200b512ec8"
Why aren't these hashing to the same value?