Skip to content

Commit

Permalink
In ROCrate change hash to sha256
Browse files Browse the repository at this point in the history
  • Loading branch information
antony-wilson committed Sep 30, 2022
1 parent 68cf143 commit eff083a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions data_management/rocrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

RO_TYPE = "@type"
FILE = "file:"
SHA256 = {"sha256": "https://schema.org/sha256"}


def _add_authors(authors, crate, entity, registry_url):
Expand Down Expand Up @@ -477,7 +478,8 @@ def _get_local_data_product(crate, data_product, registry_url, output):
}

if data_product.object.storage_location.hash is not None:
properties["hash"] = data_product.object.storage_location.hash
properties["sha256"] = data_product.object.storage_location.hash
crate.metadata.extra_terms.update(SHA256)

if data_product.object.description is not None:
properties["description"] = data_product.object.description
Expand Down Expand Up @@ -554,7 +556,8 @@ def _get_software(crate, software_object, registry_url, software_type):
)

if software_object.storage_location.hash is not None:
crate_software_object["hash"] = software_object.storage_location.hash
crate_software_object["sha256"] = software_object.storage_location.hash
crate.metadata.extra_terms.update(SHA256)

_add_licenses(crate, crate_software_object, software_object, registry_url)

Expand Down

1 comment on commit eff083a

@RyanJField
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I have no problem with calling the hash SHA256 to meet RO Crate Standards, there is the issue that the HASH stored on the registry is an SHA1 hash and not SHA256 see: Issue 221 on the FAIR CLI Repo. This may need another discussion as Github still used SHA1. @richardreeve

Please sign in to comment.