3 ms·
Several years ago I worked on a security product that used git as a sort of tripwire-type database. Since SHA1 was considered inadequate for Real Security, we h
by stickfigure 10y ago
Several years ago I worked on a security product that used git as a sort of tripwire-type database. Since SHA1 was considered inadequate for Real Security, we had to hack jgit to use SHA256. It took a stupid amount of work - the 160-bit hash size was scattered all over the codebase in countless magic numbers. But it worked.
The product was cancelled. I always wondered if the patch would be of any use to anyone.
- dingo_bat 10y ago> I always wondered if the patch would be of any use to anyone. You think? I dunno why you wouldn't try to submit a pull request though.
- dfox 10y agoBecause for inclusion into upstream git it has to be done in some at least somewhat backward compatible manner, which is not exactly trivial.
- mrtesthah 10y agoYou could have simply truncated the 256-bit hashes to 160-bit, exactly as Linus is suggesting in this post.
- kqr 10y ago160 bits are still quite many. You could have done what Linus suggests and use a better hash but truncate it. If it's a good hash, a truncation of it should still be good (modulo the fewer number of bits, of course.)
- hvidgaard 10y agoThat is jerry rigging it. If a stronger hash function is known to be secure, you throw all that confidence out the window if you truncate it. At best you reduce the brute force complexity, at worst you enable pre-image attacks.
- Nutomic 10y agoThis is wrong. There is no faster way for preimage attacks with truncated SHA-2. http://crypto.stackexchange.com/questions/9435/is-truncating-a-sha512-hash-to-the-first-160-bits-as-secure-as-using-sha1 http://crypto.stackexchange.com/questions/9435/is-truncating...
- hvidgaard 10y agoI never said that, at all. I explicitely say At best you reduce the brute force complexity, at worst you enable pre-image attacks. One thing I hate about crypto talk is statements like this So, truncating one of the SHA-2 functions to 160 bits is around 2^20 times stronger when it comes to collision resistance. Which is all too broad. What if SHA-1 is down to 2^10, is truncated SHA-2 2^30? Does it mean we have proved that no weakness exist in SHA-2? A correct statement would simply be that no known attack exists on truncated SHA-2 yet.
- alexeiz 10y agoThis is a typical outcome. You worry about some hypothetical threat, spend countless hours mitigating the threat instead of working on useful features, money goes down the drain, and then the project gets canceled. Security is just one of the features of a product. It's not more special that other features. You prioritize it like the rest of product features.