:py:mod:`hash` ============== .. py:module:: hash .. autoapi-nested-parse:: Hash computation utilities (MD5, SHA1, SHA256, SHA512). Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: hash.__compute_hash hash.md5 hash.sha1 hash.sha256 hash.sha512 .. py:exception:: HashError(message: str | list[str], origin: str | None = None) Bases: :py:obj:`e3.error.E3Error` Exception raised for hash computation errors. .. py:function:: __compute_hash(path: os.PathLike[str] | str, kind: Literal[md5, sha1, sha256, sha512]) -> str Compute hash of a file. :param path: path to a file :param kind: hash algorithm to use .. py:function:: md5(path: os.PathLike[str] | str) -> str Compute md5 hexadecimal digest of a file. :param path: path to a file :return: the hash of the file content :raise HashError: in case of error .. py:function:: sha1(path: os.PathLike[str] | str) -> str Compute sha1 hexadecimal digest of a file. :param str path: path to a file :return: the hash of the file content :raise HashError: in case of error .. py:function:: sha256(path: os.PathLike[str] | str) -> str Compute sha256 hexadecimal digest of a file. :param str path: path to a file :return: the hash of the file content :raise HashError: in case of error .. py:function:: sha512(path: os.PathLike[str] | str) -> str Compute sha512 hexadecimal digest of a file. :param str path: path to a file :return: the hash of the file content :raise HashError: in case of error