-
Notifications
You must be signed in to change notification settings - Fork 63
feat: replace sha1 and tiny-keccak with sha-1 and sha3 #52
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
Conversation
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
BenchmarkThe results are not significantly different on my machine. before
after
|
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Thanks for adding benchmarks. With the merge of #45 the codebase changed quite a lot. Could you please rebase the benchmarks? Why switching crates if there is not really a perf difference? |
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Because |
Question:
Why not that?
|
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.
I want to run the benchmarks myself locally (also with bigger data sizes), but until I've done that I've one more comment (rest looks good). I thought I publish it now before I run the benchmarks, so you can comment/react on it (or not :)
@@ -1,12 +1,10 @@ | |||
use blake2b_simd::Params as Blake2b; | |||
use blake2s_simd::Params as Blake2s; | |||
use digest::Digest; | |||
use sha1::Sha1 as Sha1Hasher; |
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.
This is a nitpick and not a reason for not merging this PR. I just want to bring it up that I did those imports at the top, so things are easy to grep for. Having absolute imports within the code makes it harder to scan over files if you like to manually refactor something or just want to get an overview over the files.
So it's about API ergonomics. The reason for having an Most simple case is: use multihash:Sha2_256;
Sha2_256::digest("some data"); If you always implement the trait, you also always need to import it. Hence it's use multihash:{MultihashDigest, Sha2_256};
Sha2_256.digest("some data"); Which is not as nice. Also the trait is using instance methods ( Though I'm happy for cleaner/better ideas for the API. I find the current API better than the old one, the once it is used more widely I expect that it still changes based on experiences using it. |
Okay, I got it. |
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.
I did run the benchmark locally with bigger sizes. There wasn't really any difference (some slower, some faster, but all in the range of just being noise (especially on my laptop where many other processes run in the background).
Also this PR #30 included that change of the hashing functions.
Thanks for the PR and also for adding more comments!
The only thing left if waiting for a final approval from @dignifiedquire.
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
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.
Looks good, thank you
sha1
andtiny-keccak
withsha-1
andsha3