-
Notifications
You must be signed in to change notification settings - Fork 8
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
Update structure of SHA3 #137
Conversation
- Refactors keccak to be in terms of `b` and `nr` per the spec - Instantiates SHA3 and SHAKE with the allowed security parameters - removes an unused reference to keccak All the tests that I could find still pass :)
- removes all the functions that parameterize on `r` because r = b - c - adjust the instantiations to set `c` appropriately - rearrange a little thing with flatten since it doesn't do padding any more
Specifically, this allows callers of `SHAKE` functions to either specify a concrete output lengths (if the needed length is known at call time) or infinite length (if there's some additional processing before truncating the output).
It kind of feels like something is wrong the with |
Hm, that's a good point. I'll make a follow-up issue about it. It actually seems like we could package up the I also have on my list to look more carefully at the state representation in this implementation. As you mention, the spec has a fairly weird indexing scheme and I'm not exactly sure that we're implementing that fully faithfully. I wonder if getting that in line would solve the input/output format inconsistency. Edit: Added #138. |
- adds some docs to various confusing bits - expands the demo calls to shake to include the nicest version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good step in the right direction, as the diff is getting a bit unwieldy I would prefer to get this in and punt most things to the next PR as you had stated.
I made #142 that introduces what I think is a nicer API for interacting with the SHA3 functions. Biggest caveat is that it's not quite as obvious how it correlates with the spec. Would appreciate your input on whether it aligns with your expectations / hopes for this spec! |
Addresses part of #132, but doesn't complete it.
This PR updates the high-level structure of SHA-3 to more closely imitate the spec. In particular, it:
keccak
implementation to reduce per-function parameterizationOne effect of this is to change the way that the hash and XOF functions are called; a remaining TODO for this PR is to fix all of the downstream failures that result from this API change.Addressed this with clarified types instead of changing a dozen downstream files! Yay!Several things here are being left to future PRs. I'll write up issues for these before this PR is merged.
nr
specifically) that don't affect the SHA-3 instantiations is being saved for a separate PR.