Since April I am using IPFS
Now I wanted to document some neat tricks and details.
When you have the hex-encoded sha256sum of a small file – for this example let’s use the GPLv3.txt on our media –
Then you can use the hash to address content directly by prefixing it with /ipfs/f01551220 so it becomes
In theory this also works with SHA1 and the /ipfs/f01551114 prefix, but then you risk experiencing non-unique content like
And dont even think about using MD5.
For this trick to work, the file needs to be added with
ipfs add --raw-leaves and it must be a single chunk – by default 256kB or smaller, but if you do the adding, you can also use larger chunks.
Here is a decoding of the different parts of the prefix:
/ipfs/ is the common path for IPFS-addressed content
f is the multibase prefix for hex-encoded data
01 is for the CID version 1
55 is for raw binary
12 is for sha2-256 (the default hash in IPFS)
20 is for 32 byte = 256 bit length of hash
And finally, you can also access this content via the various IPFS-web-gateways:
You can also do the same trick with other multibase encodings of the same data – e.g. base2
Base2 looks pretty geeky, but so far I have not found practical applications.
Both comments and pings are currently closed.