Skip to content

DN-8130: show md5 and sha1 in hunt result output#239

Merged
sbneto merged 1 commit into
developfrom
DN-8130-md5-sha1-hunt-results
May 14, 2026
Merged

DN-8130: show md5 and sha1 in hunt result output#239
sbneto merged 1 commit into
developfrom
DN-8130-md5-sha1-hunt-results

Conversation

@sbneto
Copy link
Copy Markdown
Contributor

@sbneto sbneto commented May 14, 2026

TL;DR

  • Text formatter: SHA1 and MD5 lines added under SHA256 for both live_result and historical_result. Only rendered when the field is present, so older API responses or URL artifacts (null md5/sha1) don't print bare `SHA1: None` rows.
  • Hash formatters: `SHA1Output` and `MD5Output` gain `historical_result` / `live_result` methods (mirroring `SHA256Output`), so `--output-format sha1` / `md5` work uniformly across hunt results and artifact instances.
  • JSON / PrettyJSON formatters: no code change needed — they emit `result.json` raw, so md5/sha1 surface automatically once polyswarm-api parses them.

Ticket: DN-8130.

Requires

All three PRs are forward-compatible at each layer: against older artifact-index, md5/sha1 stay null and the CLI skips the lines.

Test plan

  • `pytest tests/` passes locally (59/59 pass against existing cassettes)
  • Against an artifact-index deployment carrying #1865 and polyswarm-api #292, `polyswarm live result ` and `polyswarm historical result ` show SHA1 / MD5 lines in text mode and the keys in JSON mode
  • `polyswarm --output-format sha1 live result ` and `--output-format md5 live result ` print just the hash
  • Older deployments without md5/sha1: the text output omits the lines, JSON output is unchanged shape

Text formatter: add SHA1 and MD5 lines under SHA256 for both
live_result and historical_result. Lines are only rendered when the
fields are present so older API responses (or null hashes on URL
artifacts) don't render bare 'SHA1: None' rows.

Hash formatters: extend SHA1Output and MD5Output with
historical_result / live_result methods mirroring SHA256Output, so
'--output-format sha1' / 'md5' work uniformly across hunt results
and artifact instances.
@sbneto sbneto merged commit d860e05 into develop May 14, 2026
1 check passed
@sbneto sbneto deleted the DN-8130-md5-sha1-hunt-results branch May 14, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants