A Rust Rewrite Makes Collision-Detecting SHA-1 Nearly Three Times Faster
Solving for faster SHA-1 collision detection
Sam Reis rebuilt SHA-1 with collision detection in Rust, using a code generator to fit collision tests into SIMD lanes. The new crate, sha1dc, runs at 68–81% of plain SHA-1's speed, compared to 28–29% for the existing sha1-checked crate. It can double the speed of git pack verification, which spends 84% of its time on SHA-1. The solver balances vector prefix groups against a scalar tail to maximize throughput.
On ordinary data about 95% of blocks leave the filter with an empty mask, so the recomputation almost never runs.
- gleenn
This seems extremely cool, but man does it also sound complicated. The write up was thorough but the algorithm seems so complicated that the author can't even write good tests for it is concerning. I would be very concerned their algorithm might accidentally skip something important accidentally given they are dealing with dynamically combining large binary expressions. You can make it fast, but if you can't prove it and it's security related that probably needs to be proved out more, even if SHA1 is already compromised.
- rurban
Does git proper already accepts rust? 2x faster pack checks would be worthwhile, as it affects everybody. I heard since 2.55 they already do
- someonebaggy
This writing almost feels AI, but it's not AI. Why is that?