Move checksum calculation to utility file

Fix checksum calculation when reading archives. Also add archive size to
support embedded archives that do not end at EOF.