Toy 3 · three minutes
A file's fingerprint.
Type something and look at the CID. Change one letter: everything changes. Put it back: the same CID returns.
Try it: change a single letter, then put it back.
The file is read here, in the browser. It isn't sent anywhere.
Computing…
It's the CID IPFS gives these bytes kept as a single block: SHA-256, written in base32. Anyone with the same bytes gets exactly the same string.
The fingerprint
On IPFS, a file's address doesn't say where it is, but what it contains. It is computed from the file itself: a function (SHA-256) turns its bytes into a 32-byte number, and the CID is that number written as text, with a few letters in front saying how it was computed.
The same content always gives the same CID, on any computer in the world. A single changed bit gives an entirely different CID. So whoever receives the file can check by themselves that it's exactly the one asked for: compute the fingerprint and compare.
A file bigger than 1 MiB is cut into pieces, each with its own fingerprint, and its CID is the fingerprint of the list of pieces. The idea stays the same.
In the terminal
# put the file online; the program checks its fingerprint$ weird storage add photo.jpg# what a CID says about itself$ weird storage inspect <cid>Every command and its flags, in the documentation
Tell your assistant
„Explain what a CID is and why two identical files have the same CID, even when different people put them online.”