def digest_filename(filename, algorithm=DEFAULT_HASH_ALGORITHM,<EOL>hash_library=DEFAULT_HASH_LIBRARY, normalize_line_endings=False):
<EOL>securesystemslib.formats.RELPATH_SCHEMA.check_match(filename)<EOL>securesystemslib.formats.NAME_SCHEMA.check_match(algorithm)<EOL>securesystemslib.formats.NAME_SCHEMA.check_match(hash_library)<EOL>digest_object = None<EOL>with open(filename, '<STR_LIT:rb>') as file_object:<EOL><INDENT>digest_object = digest_fileobject(<EOL>file_object, algorithm, hash_library, normalize_line_endings)<EOL><DEDENT>return digest_object<EOL>
<Purpose>
  Generate a digest object, update its hash using a file object
  specified by filename, and then return it to the caller.

<Arguments>
  filename:
    The filename belonging to the file object to be used.

  algorithm:
    The hash algorithm (e.g., 'md5', 'sha1', 'sha256').

  hash_library:
    The library providing the hash algorithms (e.g., 'hashlib').

  normalize_line_endings:
    Whether or not to normalize line endings for cross-platform support.

<Exceptions>
  securesystemslib.exceptions.FormatError, if the arguments are
  improperly formatted.

  securesystemslib.exceptions.UnsupportedAlgorithmError, if the given
  'algorithm' is unsupported.

  securesystemslib.exceptions.UnsupportedLibraryError, if the given
  'hash_library' is unsupported.

<Side Effects>
  None.

<Returns>
  Digest object (e.g., hashlib.new(algorithm)).