|
|
Subscribe / Log in / New account

Whatever happened to SHA-256 support in Git?

Whatever happened to SHA-256 support in Git?

Posted Jun 23, 2022 18:21 UTC (Thu) by klossner (subscriber, #30046)
In reply to: Whatever happened to SHA-256 support in Git? by mathstuf
Parent article: Whatever happened to SHA-256 support in Git?

Isn't the length of the hash all you need to distinguish? SHA1 hashes are 40 characters long while SHA256 hashes are 64. (Which breaks any home-brew software that operates on git trees and hard-codes the 40-character width.)


to post comments

Whatever happened to SHA-256 support in Git?

Posted Jun 23, 2022 18:25 UTC (Thu) by bluss (guest, #47454) [Link] (1 responses)

A lot of the tools (for example git log --graph) use abbreviated hashes.

Whatever happened to SHA-256 support in Git?

Posted Jun 23, 2022 20:26 UTC (Thu) by wtarreau (subscriber, #51152) [Link]

There's no problem with that at all, not more than there is any with abbreviated commits nowadays. Git would just need to try to resolve an abbreviated commit to both SHA1 and SHA2 and complain in case of multiple matches. Then for the 40-char ones (SHA1) it would just have to do the same. In practice you won't design SHA2 hashes that purposely commit with SHA1, and the probability that it happens by accident is as low as having two identical SHA1 commits by accident, i.e. so close to zero that it practically is for our entire civilization.

Whatever happened to SHA-256 support in Git?

Posted Jun 24, 2022 16:18 UTC (Fri) by smammy (subscriber, #120874) [Link] (2 responses)

There's also Multihash, for what it's worth.

Whatever happened to SHA-256 support in Git?

Posted Jun 25, 2022 17:46 UTC (Sat) by ms-tg (subscriber, #89231) [Link] (1 responses)

> There's also Multihash, for what it's worth.

How can we get this amplified? From my understanding, adopting multihash would go a long way to future-proofing git, as there would be a single “before multihash” case to account for, and then all future iterations would be signaling the encoding in-band with the ability to add future options cleanly? Wouldn’t it?

Whatever happened to SHA-256 support in Git?

Posted Jun 27, 2022 15:24 UTC (Mon) by smammy (subscriber, #120874) [Link]

Git people are so into shortened hashes that I doubt they'd go for a format that requires a four-digit prefix. Multihash has been discussed but obviously that never went anywhere.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds