Cleanup `archive.lookup_missing_hashes` and `api_swhid_known`
Each commit is self-contained and has its own description. But the basic idea is to try to:
- Work with structured information not strings as long as possible
- Avoid mixing hashes of different types of objects together
Migrated from D7749 (view on Phabricator)