Menu

1 / 6

Solving for faster SHA-1 collision detection — sam reis

Hacker News·about 1 month ago
#tpCUkxeK
#sam#sha1dc#sha1#git#simd
Reading 0:00
15s threshold

tl;dr: I discovered collision-detecting SHA-1 is slow and decided to build my own. sha1dc is a rewrite of SHA-1 with collision detection, whose code generator uses a solver to fit collision tests into SIMD lanes. It runs at 68–81% of plain SHA-1's speed where the existing crate runs at 28–29%, and can make git pack verification twice as fast.

How git uses SHA-1 and why it has to be slow(er)

As part of working on Enroute , I'm currently deep into optimizing the performance of a git server backend. One thing you do a lot in a git server is accepting pack files from git clients. These pack files are untrusted input and have to be validated, which includes checking the SHA-1 hash of the included git objects.

I'm using gitoxide and as it turns out, pack verification can be quite slow.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.