scancode-toolkit icon indicating copy to clipboard operation
scancode-toolkit copied to clipboard

Add sha256 checksum for files

Open nishakm opened this issue 6 years ago • 3 comments

Short Description

When doing a scan of a file, we get sha1 and md5 checksums:

  "files": [
    {
      "path": "bpftool",
      "type": "file",
      "name": "bpftool",
      "base_name": "bpftool",
      "extension": "",
      "size": 1137832,
      "date": "2019-04-17",
      "sha1": "ebc8038723944dac6aa184b9aeb84488be05062e",
      "md5": "f0c381c373fb110d2afbd8d9895f2a2f",
      "mime_type": "application/x-executable",
      "file_type": "ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.2.0, BuildID[sha1]=9fecc3a68cf22ec489867811587268f35b8f924d, stripped",
      "programming_language": null,
      "is_binary": true,
      "is_text": false,
      "is_archive": false,
      "is_media": false,
      "is_source": false,
      "is_script": false,

It would be nice to add a sha256 checksum as well.

Possible Labels

  • new feature

Select Category

  • Enhancement [x]
  • Add License/Copyright []
  • Scan Feature [x]
  • Packaging []
  • Documentation []
  • Expand Support []
  • Other []

Describe the Update

Add a new checksum type for sha256

How This Feature will help you/your organization

  • If we do have files of known sha256 digests in a database somewhere, it would be easy to use scancode's file level inventory data rather than do the hashing ourselves.
  • sha256 is probably the only digest used in cloud native.

Can you help with this Feature

Of course! I will need some guidance on where to make the change though :)

nishakm avatar Feb 13 '20 18:02 nishakm

Seems fairly easy to add, since there's already a function to calculate the sha256 checksum. Would just require adding it to the scan output, and perhaps add tests for it. May I take it up? @pombredanne, @nishakm.

gaupeng avatar Feb 15 '20 18:02 gaupeng

@pombredanne it seems like this issue can be closed. The corresponding pull request was merged almost 2 years ago.

Jeeppler avatar Mar 02 '22 13:03 Jeeppler

Completed in develop. Thanks!

pombredanne avatar Jan 04 '23 15:01 pombredanne