Skip to content

module file_hashes_table

Methods for computing and displaying various file hashes.

Global Variables

  • LEFT
  • GREY

function bytes_hashes_table

bytes_hashes_table(
    bytes_or_bytes_info: Union[bytes, BytesInfo],
    title: Optional[str] = None,
    title_justify: str = 'left'
) → Table

Build a Rich Table displaying the size, MD5, SHA1, and SHA256 hashes of a byte sequence.

Args:

  • bytes_or_bytes_info (Union[bytes, BytesInfo]): The bytes to hash, or a BytesInfo namedtuple with precomputed values.
  • title (Optional[str], optional): Optional title for the table. Defaults to None.
  • title_justify (str, optional): Justification for the table title. Defaults to "LEFT".

Returns:

  • Table: A Rich Table object with the size and hash values.

function compute_file_hashes

compute_file_hashes(_bytes: bytes) → BytesInfo

Compute the size, MD5, SHA1, and SHA256 hashes for a given byte sequence.

Args:

  • _bytes (bytes): The bytes to hash.

Returns:

  • BytesInfo: BytesInfo namedtuple containing size, md5, sha1, and sha256 values.

function compute_file_hashes_for_file

compute_file_hashes_for_file(file_path) → BytesInfo

Compute the size, MD5, SHA1, and SHA256 hashes for the contents of a file.

Args:

  • file_path (str): Path to the file to hash.

Returns:

  • BytesInfo: BytesInfo namedtuple containing size, md5, sha1, and sha256 values for the file contents.

class BytesInfo

BytesInfo(size, md5, sha1, sha256)


This file was automatically generated via lazydocs.