‹ BackHN Continuity

Thread

Git 3.0's upcoming SHA-256 default will be a costly mistake

570 points · 536 comments · chmaynard

  1. gandreani · · focus · HN ↗
    One of my favorite fun facts about Fossil SCM (another source control by the devs of sqlite) is that they patched their use of SHA1 6 days after the shattered attack was published:

    "Both Fossil and Git started out using only SHA1 hashes. But when the SHAttered attack against SHA1 was published on 2017-02-23, the need to migrate to a stronger hash algorithm was recognized. Fossil added the ability to use SHA3-256 as an alternative on 2017-03-01 (six days after the SHAttered attack was first published). SHA3-256 is now the default for all new repositories and check-ins in Fossil, though older check-ins that occurred prior to SHAttered can still use their original SHA1 hash. Hence, no repositories had to be rebuilt and no hyperlinks were broken."

    <a href="https:&#x2F;&#x2F;fossil-scm.org&#x2F;home&#x2F;doc&#x2F;trunk&#x2F;www&#x2F;hundredandone.md" rel="nofollow">https:&#x2F;&#x2F;fossil-scm.org&#x2F;home&#x2F;doc&#x2F;trunk&#x2F;www&#x2F;hundredandone.md

    To me it&#x27;s so interesting watching in realtime Git is still battling with this decision and for Fossil it was just another week of development.

    That whole page is fun to read. Another fun fact somewhere else in the docs is that Fossil uses a grow-only set to store commits. They came up with this scheme some years before it was formalized by CRDTs!

    1. 6thbit · · focus · HN ↗
      That&#x27;s impressive. I suppose they had a more flexible architecture to make that change so fast.

      Is there any writeup on why it was easy for them and not for git?

      1. toymin · · focus · HN ↗
        My guess is that it&#x27;s less about the architecture and more about the blast radius and the number of users
        1. froh · · focus · HN ↗
          no it&#x27;s about the architecture and design: fossil enables coexistence of both hashes in one repo

          <a href="https:&#x2F;&#x2F;fossil-scm.org&#x2F;home&#x2F;doc&#x2F;trunk&#x2F;www&#x2F;hundredandone.md" rel="nofollow">https:&#x2F;&#x2F;fossil-scm.org&#x2F;home&#x2F;doc&#x2F;trunk&#x2F;www&#x2F;hundredandone.md

          27. Fossil allows both legacy SHA1 hashes and newer SHA3-256 hashes in the same repository.

      2. gandreani · · focus · HN ↗
        Hmm probably nothing architecture wise. It&#x27;s probably just the fact that fossil is developed by way fewer devs.

        From the skim I read of this article it seems both projects arrived at the same solution: support both but make SHA-256 the default.

        1. kccqzy · · focus · HN ↗
          No it’s different. Git supports both but you cannot mix them in a repo. Fossil allows mixing them in a single repo. This is clearly stated in the link.
          1. xyzsparetimexyz · · focus · HN ↗
            They should let you mix it in a repo then.
            1. conartist6 · · focus · HN ↗
              They do apparently. There&#x27;s information about it in the comment thread on this story on lobste.rs
        2. rurban · · focus · HN ↗
          SHA3-256 != SHA-256
          1. gandreani · · focus · HN ↗
            Oops! I admit I don&#x27;t have much knowledge on hashing algos. I thought it was a shorthand
    2. schacon · · focus · HN ↗
      I mean, there are two things here. One is how difficult it is to have a different hashing mechanism. Brian and other heroes in the Git core group have done amazing work to make this _technically_ possible on a repo level. To test some of my theories, I trivially implemented MD5 and an insanely dumb and easily breakable hash backend. It&#x27;s not _hard_ to change the mechanism now. It&#x27;s about the community.

      Fossil isn&#x27;t difficult to change not because it&#x27;s technically harder for Git but because Git has a community and ecosystem that Fossil does not. The cost is not in the individual project for Git, the cost is because there is _so much_ in Git and this bifurcates everything.

      1. gandreani · · focus · HN ↗
        Agreed! This isn&#x27;t a tech dig at all.

        To me it&#x27;s more of a reality of creating a tool with a huge active community and a community of contributors and creating a tool with a small team and small community.

      2. schacon · · focus · HN ↗
        Also, interestingly, Git today does _not_ use a straight SHA1 because of these attacks. It uses `sha1dc`, a slower collision detecting variant that specifically checks for this vector of attacks. So currently, Git&#x27;s SHA-1 variant is not susceptible to the SHAttered&#x2F;Shambles attacks.
        1. jmyeet · · focus · HN ↗
          Sure but that&#x27;s just kicking the can down the street. It will eventually be susceptible to a collision attack. As will SHA256 btw. What then? Are we doing to go through all this again?

          Online video has handled this. There are various codex, container formats and transport protocols. The TLS handshake does this. The ability to deprecate and replacing the hashing algorithm should&#x27;ve been built in from day 1.

      3. mook · · focus · HN ↗
        As an expansion on that, as far as I know there&#x27;s only one implementation of Fossil. There was at least a Java one for git, I believe, and I don&#x27;t think upstream git is related to libgit2 either. And GitHub is doing… something not visible from the outside.

        (… looking at the parent, though, I imagine there might be some information from the inside…)

        1. sgbeal · · focus · HN ↗
          &gt; As an expansion on that, as far as I know there&#x27;s only one implementation of Fossil.

          That&#x27;s is, since only recently, no longer strictly true: the age-old libfossil recently got client sync support, so is now (aside from _serving_ repos) essentially a standalone impl (its own developer still uses fossil(1) stash, patch, and diff -tk features, but otherwise uses libfossil&#x27;s counterparts).

          Also, Dan Mestas has &lt;<a href="https:&#x2F;&#x2F;github.com&#x2F;danmestas&#x2F;go-libfossil" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;danmestas&#x2F;go-libfossil&gt;, a Go library for working and fossil, and he is also working on &lt;<a href="https:&#x2F;&#x2F;zeitforge.app&#x2F;" rel="nofollow">https:&#x2F;&#x2F;zeitforge.app&#x2F;&gt;, a clean-room impl. of fossil (whereas libfossil is largely ported directly from fossil(1)) which even goes so far as to _not_ use an sqlite database for its file storage.

          Dan Mestas and Dan Shearer are working on finalizing RFCs for fossil&#x27;s sync protocol and artifact format, and zeitforge is created by carefully managing LLMs which are reading that draft (but not the source code of libfossil or fossil).

          1. gandreani · · focus · HN ↗
            I personally have been using `go-libfossil` in a project! It&#x27;s got some sharp edges but insanely useful in avoiding CGO and using fossil at the same time
    3. fragmede · · focus · HN ↗
      It&#x27;s easier to make world breaking changes when the world is really small. If git could magically just get everything and everyone to cut over and use git 3.0 in a magic instant, it wouldn&#x27;t be having this problem.
      1. nofunsir · · focus · HN ↗
        Here&#x27;s a stoichiometric bird for you:

        :%s&#x2F;git 3\.0&#x2F;python 3.0&#x2F;g

        1. fragmede · · focus · HN ↗
          Or IPv6 or windows 11.

          :x

          Neovim&#x27;s lazyvim plugin sucks because it takes over H C and L.

          1. Dylan16807 · · focus · HN ↗
            Huh wha? What problems are solved by getting all Windows users onto Windows 11 in particular?
            1. rovr138 · · focus · HN ↗
              Security since Windows 10 and below are not supported.

              <a href="https:&#x2F;&#x2F;support.microsoft.com&#x2F;en-us&#x2F;windows&#x2F;deployment&#x2F;updates-lifecycle&#x2F;windows-10-support-has-ended-on-october-14-2025" rel="nofollow">https:&#x2F;&#x2F;support.microsoft.com&#x2F;en-us&#x2F;windows&#x2F;deployment&#x2F;updat...

              &gt; Windows 10 support has ended on October 14, 2025

              1. Dylan16807 · · focus · HN ↗
                That&#x27;s not true because of extended support, but even if it was true, what&#x27;s the goal here? What benefit does the entire ecosystem share from getting people standardized on 11? Botnets get 25% smaller? That&#x27;s not some kind of important threshold. Or developers can count on access to a newer mutex API or something? Whereas getting everyone on the same git hash or python or IP protocol streamlines things enormously.
                1. rovr138 · · focus · HN ↗
                  &gt; Whereas getting everyone on the same git hash or python or IP protocol streamlines things enormously.

                  You don&#x27;t think that if we had everyone on the same Windows version we could streamline things enormously?

                  For MS, for developers, for hardware manufacturers, and so on to be able to deploy, for example, ipv6 since everyone is on the same stack? Same stack, same bugs, same fixes.

                  1. Dylan16807 · · focus · HN ↗
                    Microsoft can already put out an update to both windows 10 and 11 at the same time. They occasionally do this for bugfixes. That hits basically all Windows users.

                    The difference in effort between updating one versus two very similar code bases is minor, especially when &quot;Windows 10&quot; and &quot;Windows 11&quot; each refer to multiple versions already.

                    For drivers you only need one version to support both.

                    IPv6 has been built into Windows for ages. If you think they can force toggle it or something, that won&#x27;t work at all and deleting Windows 10 wouldn&#x27;t make it easier.

                    1. rovr138 · · focus · HN ↗
                      So you&#x27;re there&#x27;s exactly 0 effort in managing things for multiple Windows versions, for anyone along the entirety of the ecosystem? From MS developer, third party developer, hardware, drivers, users, etc?

                      How about testing? Do you think that there&#x27;s no testing put out when a fix has to go out for 2 OS, regardless of how similar they are?

                      &gt; What problems are solved by getting all Windows users onto Windows 11 in particular?

                      I have given a few. If you don&#x27;t want to see it, that&#x27;s fine.

                      1. Dylan16807 · · focus · HN ↗
                        Exactly 0? I said it&#x27;s not &quot;streamlined enormously&quot;.

                        I would estimate that supporting both windows 10 and 11 is a single digit percentage harder than supporting just one of them.

                        &gt; I have given a few. If you don&#x27;t want to see it, that&#x27;s fine.

                        Where? You said something vague about streamlining, and the only concrete example was something about &quot;deploy ipv6&quot; which Microsoft did back in Vista.

      2. samus · · focus · HN ↗
        It seems Fossil can use multiple hash algorithm within the same repository. Yes, that decreases overall security since the hashes pointing to older objects can still be spoofed.
    4. bawolff · · focus · HN ↗
      in fairness, git switched to sha1-DC in may 2017, so they were only a few months late in mitigating it.
      1. Karliss · · focus · HN ↗
        Isn&#x27;t sha1-dc just checking for a small list of hard coded disturbance vectors? Meaning that script kiddies can&#x27;t easily reuse exact values that researchers spent a bunch of time precomputing. That&#x27;s far from being a good long term solution.
        1. someonebaggy · · focus · HN ↗
          Yes.
        2. bawolff · · focus · HN ↗
          I&#x27;m not an expert on this but my impression is its a bit in the middle. It isn&#x27;t a great long term solution, but finding new disturbance vectors is very hard. Its not like someone can just go find more on a whim.
    5. hedora · · focus · HN ↗
      The saga continues with that proposed terrible github UI in the article (from a github cofounder!)
    6. ncr100 · · focus · HN ↗
      Feels like Leadership of Fossil SCM is better than that for git.

      (Because: This very old problem is ongoing with git, and is closed with Fossil.)

      1. gb67890 · · focus · HN ↗
        can I have your email to get in touch
    7. somat · · focus · HN ↗
      I always liked the ipfs concept of a multihash where a hash algorithm id is stored with the hash, I don&#x27;t know how well it worked in practice, but in theory all applications of the protocol are now forced into a world where there are multiple hash formats and it can and will change.
      1. jmyeet · · focus · HN ↗
        We don&#x27;t need that. Introducing an unknown hash algorithm itself is a security issue.

        This problem isn&#x27;t hard or new. Just look at things like a TLS handshake. You need to separate the protocol from the storage implementation.

        I personally believe the initial Git programmers were too in love with the efficiency of doing a bitwise 160 bit comparison on the stack and they sacrificed the known issue of changing the algorithm to do it. A decade earlier the same thing had happened with MD5.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.