Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

SHA3 stuck on flawed "binary" encoding #4081

Closed
gavofyork opened this issue Jan 8, 2017 · 1 comment · Fixed by #4108
Closed

SHA3 stuck on flawed "binary" encoding #4081

gavofyork opened this issue Jan 8, 2017 · 1 comment · Fixed by #4108
Labels
F2-bug 🐞 The client fails to follow expected behavior. M6-rpcapi 📣 RPC API.
Milestone

Comments

@gavofyork
Copy link
Contributor

parity.api.util.sha3 interprets its argument as 'binary' information. This is problematic since there are certain binary blobs that JS cannot encode as a string, which get opaquely coerced to some other string.

web.sha3 addresses this by interpreting 0x prefixed strings as hex-encoded data - other inputs are assumed to be binary-block strings.

It should probably be consistent with web3.sha3. Failing that, it should remain consistent with the JSONRPC's conventions and only accept hex-encoded data.

@gavofyork gavofyork added F2-bug 🐞 The client fails to follow expected behavior. M6-rpcapi 📣 RPC API. labels Jan 8, 2017
@gavofyork gavofyork added this to the 1.5 Tenuity milestone Jan 8, 2017
@gavofyork gavofyork changed the title SHA3 stuck on ASCII/UTF-8 encoding SHA3 stuck on flawed "binary" encoding Jan 8, 2017
@tomusdrw
Copy link
Collaborator

tomusdrw commented Jan 9, 2017

Seems that web3.sha3 has an additional option to indicate that data is hex-encoded bytes: https://github.com/ethereum/web3.js/blob/develop/lib/utils/sha3.js#L26

Looks like we already do something similar:
https://github.com/ethcore/parity/blob/master/js/src/api/util/sha3.js

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F2-bug 🐞 The client fails to follow expected behavior. M6-rpcapi 📣 RPC API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants