def CalculateHashesFromContents(fp, hash_dict, callback_processor=None):
  while True:
    data = fp.read(DEFAULT_FILE_BUFFER_SIZE)
    if not data:
      break
    for hash_alg in hash_dict.itervalues():
      hash_alg.update(data)
    if callback_processor:
      callback_processor.Progress(len(data))
Calculates hashes of the contents of a file.
dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/hashing_helper.py/CalculateHashesFromContents