I think I’m missing something. Why can’t your program store a URL and CID? I’m missing why the SHA256 is required instead of something that IPFS can natively use.
I want to work with publicly available files which just contain the URL and the SHA256 sum.
Sure, I can download a file, calculate the SHA256 sum and then store it into IPFS to get the CID.
But: How do the next client avoid to download the file again to get to the CID when he reads the publicly available file with URL/SHA256 sum?
I can store the relationship between SHA256 and CID locally, but I have no idea how to store such a relationship in IPFS in a way that I can request the CID from IPFS when I only know the SHA256.
As a tangent, this sounds related to the experimental urlstore feature. As part of it, you can pass in a URL and get a CID for the file. Then nodes can request the file through your node using the CID.
Correct me when I’m wrong, but:
URLstore is just a feature to avoid storing a file locally when you got a webserver serving this file reliability anyway.
Storing the file not locally doubles the traffic on all nodes, since they first have to download the file from the webserver when it has been requested via IPFS, instead of beeing able to read from the local disk.