This repository has been archived by the owner on Dec 23, 2020. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The implementation was ported from Bouncy Castle. It passes the included tests on both the VM and in Firefox. I got the hash values from b2sum, the reference implementation. I changed the digest test method to test both
update()
andupdateByte()
instead of justupdate()
. The tests don't include passing a key, salt, or personalization. Let me know if you want me to add that in this PR.I changed
Register64.setRange()
to behave likeList.setRange()
in the standard library. Before, it always copied corresponding indexes, even if you passed a start != 0. No existing uses depended on this (surprising to me) behavior.I did some brief optimization. Making the
m
list a member variable instead of a local made the benchmark about 6% faster (because it reduces allocations?). Adding aRegister64.sumReg()
method that doesn't have a branch forint
made it an additional ~6% faster. I'm not sure it can be optimized further, as most of the time is spent inRegister64
methods. Now on my i7-6700K 4.0GHz processor, I get about 40.5 MB/s.