zkat / cacache-rs

A high-performance, concurrent, content-addressable disk cache, with support for both sync and async APIs. 💩💵 but for your 🦀
https://crates.io/crates/cacache
Other
523 stars 33 forks source link

Is cacache checking for hash collisions? #76

Open RustyNova016 opened 4 months ago

RustyNova016 commented 4 months ago

One thing missing from the readme is whether cacache checks for hash collisions, since hashes seems to be the way the contents is indexed internally. While they are rare, that's definitely something to be worried about

So is cacache checking for those or do we have to manually check it ourselves?

zkat commented 4 months ago

cacache defaults to, iirc, sha256. The odds of hash collisions is... negligible. I think testing for it would be overkill, tbh.

If you had 1 billion entries in cacache, your chances of a hash collision with sha256 are 4.3*10^-60

For sha512, which you can opt into, it's even more.

You're more likely to have an asteroid strike earth and kill us all in the next 30 seconds.