Coder Social home page Coder Social logo

Comments (5)

certik avatar certik commented on May 29, 2024

How does git handle collisions? Or it assumes that with 32 chars the collision will never happen?

from hashdist.

dagss avatar dagss commented on May 29, 2024

First, git has 40 chars (both git and hashdist use 160 bits, but bit uses base-16 and we base-32).

And with 160 bits, collisions will not happen (the chance is so low it's almost not an assumption; except if there are mathematical weaknesses in SHA-1 (git) or SHA-2 (hashdist)).

(If we simply include all 32 characters in the main artifact prefix path itself, we don't need to worry either, but I really like the shorter path.)

Here's what happens with git: If you have a collision, the first object to hit your .git/objects is the one that wins. Another object with the same commit simply never gets fetched or downloaded.

from hashdist.

dagss avatar dagss commented on May 29, 2024

I now believe this must be done.

UI when having a full collision, instead of growing hash we do:

$ hit build
...
The target directory ~/.hashdist/ba/numpy/qmplawvo3kyy already exists.
This may be because of an earlier sudden crash, or because somebody
else is currently performing the build on a shared filesystem. Please run "hit purge numpy/qmplawvo3kyy" to manually clean out the directory.

Collision on short part only:

$ hit build
WARNING: An artifact with a hash that agrees in the first 12 characters
is already installed. The two hashes are:

numpy/qmplawvo3kyyvgo54pcazh4pnvfyjz53 (installed)
numpy/qmplawvo3kyyh4pnvfyf8s3vgo54pcaz (wants to install)

The odds of this happening due to chance are very low. Please get in touch with the Hashdist developer mailing list.

from hashdist.

certik avatar certik commented on May 29, 2024

How did you manage to hit the hash collision? Or is the probability not that low.

In any case, yes, it should get done.

from hashdist.

dagss avatar dagss commented on May 29, 2024

What? I just made those examples up. I haven't hit any collisions, no.

from hashdist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.