o
    ÙtBhé  ã                   @   sH   d dl Z d dlZd dlZd dlmZ dd„ Zdd„ ZG dd„ deƒZdS )	é    N)ÚCommonChecksumc                 C   s   t jj | |t|ƒ¡S )aY  Update an existing CRC checksum with new chunk of data.

    Args
        crc (int): An existing CRC check sum.
        chunk (Union[bytes, List[int], Tuple[int]]): A new chunk of data.
            Intended to be a byte string or similar.

    Returns
        int: New CRC checksum computed by extending existing CRC
        with ``chunk``.
    )Úgoogle_crc32cÚ_crc32c_cffiÚlibÚcrc32c_extendÚlen)ÚcrcÚchunk© r
   úi/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/google_crc32c/cffi.pyÚextend   s   r   c                 C   s   t jj | t| ƒ¡S )züCompute a CRC checksum for a chunk of data.

    Args
        chunk (Union[bytes, List[int], Tuple[int]]): A new chunk of data.
            Intended to be a byte string or similar.

    Returns
        int: New CRC checksum computed for ``chunk``.
    )r   r   r   Úcrc32c_valuer   )r	   r
   r
   r   Úvalue'   s   
r   c                   @   s&   e Zd ZdZdZd	dd„Zdd„ ZdS )
ÚChecksumzÈHashlib-alike helper for CRC32C operations.

    Args:
        initial_value (Optional[bytes]): the initial chunk of data from
            which the CRC32C checksum is computed.  Defaults to b''.
    )Ú_crcó    c                 C   s   t |ƒ| _d S )N)r   r   )ÚselfÚinitial_valuer
   r
   r   Ú__init__>   s   zChecksum.__init__c                 C   s   t | j|ƒ| _dS )z®Update the checksum with a new chunk of data.

        Args:
            chunk (Optional[bytes]): a chunk of data used to extend
                the CRC32C checksum.
        N)r   r   )r   r	   r
   r
   r   ÚupdateA   s   zChecksum.updateN)r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r
   r
   r
   r   r   4   s
    
r   )	ÚstructÚgoogle_crc32c.__config__r   Úgoogle_crc32c._crc32c_cffiÚgoogle_crc32c._checksumr   r   r   r   r
   r
   r
   r   Ú<module>   s   