docs: def digest_manifest(self, manifest, java_algorithm="SHA-256"):
          """
          Create a main section checksum and sub-section checksums based off
          of the data from an existing manifest using an algorithm given
          by Java-style name.
          """
  
          # pick a line separator for creating checksums of the manifest
          # contents. We want to use either the one from the given
          # manifest, or the OS default if it hasn't specified one.
          linesep = manifest.linesep or os.linesep
  
          all_key = java_algorithm + "-Digest-Manifest"
          main_key = java_algorithm + "-Digest-Manifest-Main-Attributes"
          sect_key = java_algorithm + "-Digest"
  
          digest = _get_digest(java_algorithm)
          accum = manifest.get_main_section()
          self[main_key] = b64_encoded_digest(accum, digest)
  
          for sub_section in manifest.sub_sections.values():
              sub_data = sub_section.get_data(linesep)
              sf_sect = self.create_section(sub_section.primary())
              sf_sect[sect_key] = b64_encoded_digest(sub_data, digest)
              accum += sub_data
  
          self[all_key] = b64_encoded_digest(accum, digest)