Further work on checksums

To test, try importing and suchlike to make sure that imports and viewing still work as before, and watch the `originalfile` table in the database to ensure that its `hash` and `hasher` columns are properly populated.

Due to conflicts this PR is on top of #1006 so don't merge until #1006 is merged.