Make CIDv0 from CIDv1 using cid.ipfs.io

Can be https://cid.ipfs.io app extended to display CIDv0 version of supplied hash as well? It does that for v1 already: you enter v0 it show v1.

I often get v1 hashes but need v0 for compatibility reasons.

1 Like

I’m assuming you’re meaning only for CIDs with their data encoded as dag-pb? Because in any other case, it won’t be possible to generate a working v0 CID as they only support that one codec (that’s what CIDv1 fixes). There’s more info about that here.

FWIW you should be able to convert reliably using the tools available, for example:

# If this outputs "protobuf" we can be reasonably certain we can convert
ipfs cid format -f "%c" -b base58btc bafybeiccuppnh2nh54jtubqo2jjmngzlnnmliejjq3xlswxzh24et2llu4
# Convert our CIDv1 to CIDv0 (returns "QmSpnYb3romJejsUqhRepYr6GBwuKUFj1kqrhtk1z2Hn8E")
ipfs cid format -f "%M" -b base58btc bafybeiccuppnh2nh54jtubqo2jjmngzlnnmliejjq3xlswxzh24et2llu4

I can pass along your question of course! I am curious though, why do you need this functionality? Just my $0.02 on the matter, we should be supporting v1 as much as possible, so I think it makes sense to display the data the way it’s currently displayed.