Add hashfile reader
This is some utility code extracted from !1256 (merged), which helps towards #1614 (closed). I'm submitting it as a separate MR because this can be reviewed on its own.
This MR adds code that lets us read Git "hashfiles", and automatically validate the checksum. A hashfile is a file where the last 20 bytes are the SHA1 checksum of all content before them. Git uses this to verify the integrity of .pack, .idx and .bitmap files.