git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] hash: introduce support for the MD5 hash algorithm

From
Toon Claes <toon@iotcl.com>
Date
Apr 1, 2026, 13:47 UTC
Message-ID
<875x6aeqsa.fsf@toon--20250203-5JQV3.mail-host-address-is-not-set>
In-Reply-To
<67f10f21-121b-426d-abee-32d034f84fe7@app.fastmail.com>
"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:
Show 48 quoted lines
> On Wed, Apr 1, 2026, at 12:42, Patrick Steinhardt wrote:
>> We are currently in the process of migrating to SHA256 as the
>> alternative to SHA1. But we believe that proposal is misguided.
>>
>> When Linus first announced Git in April 2005, he was explicit about the
>> role of SHA1 in the design: the hash is used for content integrity, not
>> for cryptographic security [1]. Given this foundational principle, the
>> collision resistance of the underlying hash algorithm is essentially
>> irrelevant. What matters is that identical content always produces the
>> same name, and that any corruption of stored data is detectable.
>>
>> While SHA256 technically provides stronger collision resistance than
>> SHA1, it does so at the cost of 64-byte object names instead of 40, a
>> 60% increase in verbosity for no practical benefit.
>>
>> As an alternative, MD5 satisfies the requirements of collision
>> resistance and deterministic checksums perfectly well. At a length of 32
>> hex characters they are shorter than SHA1, roll off the tongue more
>> easily, and have been a beloved companion to the software engineer for
>> decades. Furthermore, it remains in active use throughout the ecosystem,
>> in checksums on download pages, filesystem integrity tools, and
>> countless systems out there, which overall proves the point that they
>> aren't inherently broken.
>>
>> Quoting Linus in [1]:
>>
>>   In other words, I think we could have used md5's as the hash, if we
>>   just make sure we have good practices. And it wouldn't have been
>>   "insecure".
>>
>> Let's do so and wire up MD5 as a new alternatitve hash algorithm next to
>> SHA1 and SHA256. Repositories can easily be initialized with MD5 by
>> saying `git init --object-format=md5`, and tests can be executed with
>> the new hash by setting the `GIT_TEST_DEFAULT_HASH_ALGO=md5` environment
>> variable.
>>
>> [1]:
>> https://lore.kernel.org/git/Pine.LNX.4.58.0504160913180.7211@ppc970.osdl.org/
>>
>> Signed-off-by: Patrick Steinhardt <ps@pks.im>
>> ---
>> Hi,
>>
>> I guess the title says it all. Let's correct course!
>>
>> Patrick
>
> I’ve been waiting years for this! Thank you so much!!!
I can't believe we'd have MD5 before GTA6.
-- 
Cheers,
Toon
Previous: Kristoffer HaugsbakkNext: Tian Yuchen
Message 3 of 7 in “hash: introduce support for the MD5 hash algorithm”
  1. hash: introduce support for the MD5 hash algorithmPatrick Steinhardt, Apr 1, 2026
  2. Kristoffer HaugsbakkApr 1, 2026
  3. Toon ClaesApr 1, 2026
  4. Tian YuchenApr 1, 2026
  5. K JayatheerthApr 4, 2026
  6. Junio C HamanoApr 1, 2026
  7. Patrick SteinhardtApr 2, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.