4 ms·
With reasonably long cryptographically strong hashes it's not a weak point (or you could call almost all cryptography a weak point). Weak point is hard-coded al
by vbezhenar 10y ago
With reasonably long cryptographically strong hashes it's not a weak point (or you could call almost all cryptography a weak point). Weak point is hard-coded algorithms and sizes into Git (if I understood the problem correctly). Software should be written with more generic approach, so algorithms could be changed and migrated when necessary. SHA-1 is considered weak for many years, git should've migrated from it already.
- DougBTX 10y agoGit could have been written with a pluggable hash system, but for something that needs to be changed let's say once every ten years, is the up front cost really worth it?
- adrianN 10y agoHow hard is it to introduce a global constant for the number of bits in your hash instead of writing char hash[40] everywhere?
- pilif 10y agoThat's not good enough though if you need to work with repositories that were made with previous releases. Just converting them is one thing, but what if you need to stay compatible indefinitely. And what about old releases that encounter a new repo? And what about URLs and emails that reference commit hashes? Think archives of mailing lists that suddenly become useless unless there's a way to keep both hashes around. Yes. These are all solvable problems (maybe not the old-release needing to handle new-style repo gracefully), but the complexity is much higher than upgrading a global constant.
- adrianN 10y agoI think you could solve most problems by just enabling a different hash function with no backwards compatibility. Repositories have a format-version somewhere, and migrating from git to git-with-new-hash should be a fairly simple operation. You can always edit commit messages to add "corresponds to commit <sha1> in <old repo>". This is of course not as nice as full backwards compatibility, but it gets rid of the security problem for relatively cheap.
- emn13 10y agoThe problem isn't the number of bits (yet). The problem is the choice of hash. A truncated sha2 would still be fine for years to come (barring a sha2 break, which doesn't look imminent). 160bits may not be a huge margin, but it's still enough.
- hvidgaard 10y ago> With reasonably long cryptographically strong hashes it's not a weak point (or you could call almost all cryptography a weak point). We do not yet know if one way functions truly exists, so from a theoretical standpoint, any hash function is a weakpoint if you do not properly handle malicious collisions. > SHA-1 is considered weak for many years, git should've migrated from it already. Linus addressed this many years ago, when de was working on the first version of Git. It was chosen, despite the fact that it was known to be weakened. I don't know if they lost sight of this, or the geniuenly still believe that malicious colliding hashes are not a problem. I do not know enough about the intimate details of Git to comment on that fact.