Skip to content

Is it possible to output kubo equivalent CID? #6

Description

@ross-spencer

I am getting two different results for simple data on the command line in Kubo versus with this library.

I believe the values should be equivalent:

With python:

    # data
    # {}

    # ipfs (kubo)
    # bafyreigbtj4x7ip5legnfznufuopl4sg4knzc2cof6duas4b3q2fy6swua

    # ipfs-cid
    # bafkreicecnx2gvntm6fbcrvnc336qze6st5u7qq7457igegamd3bzkx7ri

    """

    ex = {}
    d = json.dumps(ex, sort_keys=True)
    cid_hash = cid_sha256_hash(d.encode())
    return cid_hash

With the ipfs cli tool kubo:

echo "{}" | ./ipfs dag put
bafyreigbtj4x7ip5legnfznufuopl4sg4knzc2cof6duas4b3q2fy6swua

Ideally the Python library would match the reference implementation. Am I missing something simple, or are the two algorithms not outputting equivalent data?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions