git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Wolf <jw@raven.inka.de>
To: git@vger.kernel.org
Subject: Re: What about SHA-1 collisions?
Date: Tue, 6 Nov 2012 23:09:38 +0100	[thread overview]
Message-ID: <20121106220938.GH28437@raven.wolf.lan> (raw)
In-Reply-To: <loom.20121106T223000-502@post.gmane.org>

On Tue, Nov 06, 2012 at 09:41:29PM +0000, John McKown wrote:
> Josef Wolf <jw <at> raven.inka.de> writes:
> > Just for curiosity: what would happen if such a collision would occur within
> > one repository?

> In a sense, this cannot happen.

In the scenario you described, contents of this version of file "b" are lost
and replaced by the contents of file "a". So file "b" is broken.

What happens when files "a" and "b" are added into different repositories?
File "a" is added to repos "A", and file "b" is added to repos "B". Now it
depends from which repository you fetch the collided blob first. If you fetch
it from "A", file "b" will be broken. If you fetch first from "B", your "a"
will be broken.

It becomes even more interesting, if some commit or tree object would have
the same SHA1 as some other object. I guess, in such a case the repository
would be completely hosed?

  reply	other threads:[~2012-11-06 22:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-06 20:26 What about SHA-1 collisions? Josef Wolf
2012-11-06 21:41 ` John McKown
2012-11-06 22:09   ` Josef Wolf [this message]
2012-11-07 15:42     ` Shawn Pearce
2012-11-07 23:44       ` Andrew Ardill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121106220938.GH28437@raven.wolf.lan \
    --to=jw@raven.inka.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).