-
-
Notifications
You must be signed in to change notification settings - Fork 328
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
Use hardened Sha1
implementations (collision detection)
#585
Comments
Some additional details:
I think implementing this in the |
I was wondering what should happen once a collision is detected, as it's critical to do the same thing that Options are…
It looks like For our implementation to be valid, we'd have to be sure that our safe hashes are indeed the same as the ones that git produces. Unfortunately I wasn't able to find a test there.
With that, it feels like it's really up to |
Fyi I have a draft of this here open now: RustCrypto/hashes#566 would be great to get feedback if this will work for gitoxide, and if not what needs to change |
Thanks for the update, thanks so much for this amazing and exciting work! From what I can tell, Something I wonder is if I will would be able to choose at runtime which implementation to use - I can imagine the new one to be quite a bit slower by merit of not being in ASM, so maybe I would want to have a git-configuration option for it rather than a compile-time-only option. |
I have updated the PR to allow for both options to be compiled in, and making the switch much more explicit |
The build options for git, and its various uses of sha1 implementations can be found here: https://github.com/git/git/blob/master/Makefile#L480-L534 TLDR: use a fast optimized implementation, unless specific build flags are specified. So my understanding is that they effectively do not use the collision detection code in any of the default builds, which is quite surprising to me. Not sure where else to look for confirmation on that. In regards to how to setup a sha1 implementation that is "good enough" for gitoxide, probably the following makes sense Combine the following three crates,
This should give roughly matching speeds with git asfaiu, assuming the same configurations. Longer term there is likely an opportunity to optimize the |
Thanks a lot for the analysis, this makes sense to me and should be good enough. And I hope one day |
sha-1
cratesha1_smol
implements hardening ([Q&A] Does this crate implement 'hardened' SHA1? mitsuhiko/sha1-smol#43)At least add a feature toggle to support this crate:
The text was updated successfully, but these errors were encountered: