Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Keccak #54

Closed
kumavis opened this issue Oct 18, 2016 · 11 comments
Closed

Support for Keccak #54

kumavis opened this issue Oct 18, 2016 · 11 comments

Comments

@kumavis
Copy link
Contributor

kumavis commented Oct 18, 2016

We need support for base Keccak as well as the already added SHA-3 standard subset of Keccak.
Ethereum calls its hash algo of choice "SHA-3" but was chosen before the standard was settled, and is more accurately called "Keccak-256".

Instance Definition
eth_sha3(M) Keccak[256](M, 256)
SHA3-224(M) Keccak[448](M
SHA3-256(M) Keccak[512](M
SHA3-384(M) Keccak[768](M
SHA3-512(M) Keccak[1024](M
SHAKE128(M, d) Keccak[256](M
SHAKE256(M, d) Keccak[512](M

table from sha-3 wiki

further reading:

@kumavis
Copy link
Contributor Author

kumavis commented Oct 18, 2016

@kumavis
Copy link
Contributor Author

kumavis commented Oct 18, 2016

cc @jbenet @diasdavid

@jbenet
Copy link
Member

jbenet commented Oct 18, 2016

Yeah absolutely, we should add all these. @diasdavid is revamping multicodec table, maybe he can assign codes for them?

@daviddias
Copy link
Member

Was just replying through IRC, but better to answer here

tl;dr; the multicodec table inside the multihash table is out of date

See https://github.com/multiformats/multicodec/tree/spec/update, it already has codes for the algos you are looking for. If I'm reading it correctly, there is a direct mapping in implementation between sha3 and Keccak, so, should we recognize both names, or will it be acceptable for devs to use the sha3 names, since their are standard by NIST?

With regards to eth_sha3, since it is a special variant, we can add it, can we call it sha3-eth, so that it is adequately namespaced like all the other sha3?

@jbenet can we get a review on multiformats/multicodec#16, there has been some proposals with regards to multicodecs

@Kubuxu
Copy link
Member

Kubuxu commented Oct 19, 2016

Its official name AFAIK, is keccak-256 so I would go with it.

@kumavis
Copy link
Contributor Author

kumavis commented Oct 19, 2016

@diasdavid to be clear, NIST standard SHA-3 is a subset of keccak. eth-sha3 uses "base" keccak-*. ( eth-sha3 is just vanilla keccak-256).

  • you can perform NIST standard SHA-3 if you have keccak-*.
  • you can perform eth-sha3 if you have keccak-*.
  • you can not perform eth-sha3 if you (only) have NIST standard SHA-3.

@kumavis
Copy link
Contributor Author

kumavis commented Oct 20, 2016

Here is the PR for selecting a codec code multiformats/multicodec#19

@axic
Copy link

axic commented Oct 26, 2016

NIST SHA3 and Keccak differ in the padding byte only, otherwise they are the same. Of course this results in entirely incompatible hashes.

The best source for Keccak is http://keccak.noekeon.org/.

@axic
Copy link

axic commented Oct 26, 2016

@diasdavid:

With regards to eth_sha3, since it is a special variant, we can add it, can we call it sha3-eth, so that it is adequately namespaced like all the other sha3?

It is not a special variant. Keccak is the hashing algorithm winning the SHA3 competition and for some reason the standard got the padding byte changed.

@Kubuxu is right, it should be called keccak-<n>

@daviddias
Copy link
Member

daviddias commented Nov 8, 2016

@axic understood, at first from a conversation, it sounded like eth_sha3 was not straight Keccak or sha3.

I believe we can close this one now, correct?

@Kubuxu
Copy link
Member

Kubuxu commented Nov 8, 2016

I think yes.

@Kubuxu Kubuxu closed this as completed Nov 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants