import hashlib


def git_blob_style_hash(data: bytes):
    """Return the hash of data as a hex string

    This is the hash that git uses for hashing blobs. You can pass the hash
    returned by this function to git to find a copy of the file in the history
    of a repository, for example

        git whatchanged --all --find-object=acab3218a50a

    >>> git_blob_style_hash(b'hi\\n')
    '45b983be36b73c0788dc9cbcb76cbb80fc7bb057'
    """
    hash = hashlib.sha1()
    hash.update(b"blob %d\0" % len(data))
    hash.update(data)
    return hash.hexdigest()