4 ms·
I just couldn't digest all, after I read this entence in the description: --- When neocitieslogo.svg is added to my IPFS node, it gets a new name: QmXGTaGWTT1u
by beyti 11y ago
I just couldn't digest all, after I read this entence in the description:
---
When neocitieslogo.svg is added to my IPFS node, it gets a new name: QmXGTaGWTT1uUtfSb2sBAvArMEVLK4rQEcQg5bv7wwdzwU. That name is actually a cryptographic hash, which has been computed from the contents of that file. That hash is guaranteed by cryptography to always only represent the contents of that file.
---
And opened a reddit/eli5 question, just to understand "if we can use a hash to identify content uniquely?" here: https://redd.it/3k8g51 https://redd.it/3k8g51
Can anybody elaborate and lighten me up a bit?
- Confiks 11y agoThere is a function that will guarantee to give you a unique 'hash' for every input value, and that is the identity function. Be sure to use a differently subscripted function for every input size though, as the fixed-length property must be satisfied. Kidding aside, the answers given on Reddit 20 minutes before your question was posted here suffice.
- deleted 11y ago[deleted]
- VikingCoder 11y agoOkay, I can't explain it like you're 5... But here's as close as I can get. You've got DNA. Everyone's DNA is unique (shhh, just go with me for a minute). In fact, let's say that we found about 140 GATC pairs, which were also unique (we don't need your whole sequence, just those 140 pairs). Meaning, if we take your 140 GATC pairs, and we take my 140 GATC pairs, we'd be guaranteed to get different results. Now, if I want to refer uniquely to a person, I can just use those 140 GATC pairs, which looks roughly like QmXGTaGWTT1uUtfSb2sBAvArMEVLK4rQEcQg5bv7wwdzwU (when expressed with upper + lower + numbers). But, you've been thinking to yourself, WHAT ABOUT TWINS?!? Well, great question... ...but the cryptographic hash that we use is one where twins are EXCEEDINGLY UNLIKELY. Like, amazingly, shockingly, oh my god, unlikely. They exist, but in practice they're so uncommon that it doesn't matter. Maybe sometime, some unfortunate guy is going to request a picture of Natalie Portman, and get an MP3 of Ted Nugent. It could happen. It's just super unlikely to ever happen in practice. So, there you have it - a cryptographic hash is... excuse me, because this is a supremely flawed analogy... kind of like the DNA of a file.
- beyti 11y agoThanks for the response, I've just thought of that single example and couldn't digest it, but it is just me. It's like [guid](http://stackoverflow.com/questions/2977593/is-it-safe-to-assume-a-guid-will-always-be-unique http://stackoverflow.com/questions/2977593/is-it-safe-to-ass...) as far as I can understand and even bigger that we shouldn't worry.
- DanBC 11y agoPigeonhole principle: https://en.wikipedia.org/wiki/Pigeonhole_principle https://en.wikipedia.org/wiki/Pigeonhole_principle I think you've correctly picked up on the difference between "uniquely" and "infeasable". It's not possible to use a hash function to give every possible input a unique reference. But a cryptographic hash function aims to make the inputs to "hash collisions" be very different. So, for real world files the hash is unique, because the file that would produce a hash collision would be malformed and useless. In general when you hash a message you don't want an attacker to make subtle changes and get the same hash. "Here is my electronic payment for £100" should never have the same hash as "Here is my electronic payment for £10,000. Nice to meet you on the weekend".