import hashlib


def file_sha1(path):
  """
  Compute SHA1 hash of a file.
  """
  sha1 = hashlib.sha1()
  with open(path, "rb") as f:
    while True:
      block = f.read(2 ** 10)
      if not block:
        break
      sha1.update(block)
    return sha1.hexdigest()