in both geth and web3.js, when we call
> web3.sha3("0x536f6d6520415343494920737472696e6720746f20626520686173686564")
we get:
requirement of using web3.fromAscii before sha3 is deprecated
new usage: 'web3.sha3("hello")'
see https://github.com/ethereum/web3.js/pull/205
if you need to hash hex value, you can do 'sha3("0xfff", true)'
"b21dbc7a5eb6042d91f8f584af266f1a512ac89520f43562c6c1e37eab6eb0c4"
So I proceed to do this:
> web3.sha3("0x536f6d6520415343494920737472696e6720746f20626520686173686564",true)
upon which I get:
"bf328f7c064d78daf8fa3e2ffe36c1c3cb22ae02832d4ead2995130ca21a8524"
This does not match the original value that I intended to get, namely
"b21dbc7a5eb6042d91f8f584af266f1a512ac89520f43562c6c1e37eab6eb0c4"
I was wondering if someone could explain to me why the two values are different. The reason I'm asking is that I'd like to sha3 this:
sha3("0xfff")
which gives me a invalid byte index error, but I know that
sha3("0xfff",true)
is not going to get me what I want, based on the above observations.