Add hashutil.hash_git_object and tests
This allows us to factor out functionality from swh.loader.dir that will be useful to a lot of other modules.