simplify import format detection
decouple hash generation from comment view and allow customization

Tests now use a dummy hash function that does nothing (basically) and
run a bit faster now.