Implement Respository.hashfile

This hashes the content of a file, without actually writing it to the
db.
Add tests for Repository.hashfile
Implement Repository.hash

This takes a string of arbitrary data (That may include null bytes) and
returns it's sha1 hash as though it were a blob, without actually
writing to the object db.
Add tests for hash