
    5i                         d dl Z d dlmZ d dlmZ ddededefdZddededefd	Zdded
edefdZ	dedededefdZ
dedededefdZdedededefdZ G d de      Zy)    N)NativeResource)Unioninputprevious_crc32returnc                 .    t        j                  | |      S )z
    Perform a CRC32 (Ethernet, gzip) computation.

    If continuing to update a running CRC, pass its value into `previous_crc32`.
    Returns an unsigned 32-bit integer.
    )_awscrtchecksums_crc32)r   r   s     r/home/marpiech/ifpan-abm-pgxpred/analysis/marpiech-gwas-test/venv/lib/python3.12/site-packages/awscrt/checksums.pycrc32r   	   s     ""5.99    previous_crc32cc                 .    t        j                  | |      S )z
    Perform a Castagnoli CRC32c (iSCSI) computation.
    If continuing to update a running CRC, pass its value into `previous_crc32c`.
    Returns an unsigned 32-bit integer.
    )r	   checksums_crc32c)r   r   s     r   crc32cr      s     ##E?;;r   previous_crc64nvmec                 .    t        j                  | |      S )z
    Perform a CRC64 NVME computation.
    If continuing to update a running CRC, pass its value into `previous_crc64nvme`.
    Returns an unsigned 64-bit integer.
    )r	   checksums_crc64nvme)r   r   s     r   	crc64nvmer      s     &&u.@AAr   crc32_result1crc32_result2data_length2c                 0    t        j                  | ||      S )ag  
    Combine two CRC32 (Ethernet, gzip) checksums computed over separate data blocks.

    This is equivalent to computing the CRC32 of the concatenated data blocks without
    having to re-scan the data.

    Given:
        crc1 = CRC32(data_block_A)
        crc2 = CRC32(data_block_B)

    This function computes:
        result = CRC32(data_block_A || data_block_B)

    Args:
        crc32_result1: The CRC32 checksum of the first data block
        crc32_result2: The CRC32 checksum of the second data block
        data_length2: The length (in bytes) of the original data that produced crc32_result2.
                      This is NOT the size of the checksum (which is always 4 bytes),
                      but rather the size of the data block that was checksummed.

    Returns:
        The combined CRC32 checksum as if computed over the concatenated data
    )r	   checksums_crc32_combine)r   r   r   s      r   combine_crc32r   %   s    0 **=-VVr   crc32c_result1crc32c_result2c                 0    t        j                  | ||      S )au  
    Combine two CRC32C (Castagnoli, iSCSI) checksums computed over separate data blocks.

    This is equivalent to computing the CRC32C of the concatenated data blocks without
    having to re-scan the data.

    Given:
        crc1 = CRC32C(data_block_A)
        crc2 = CRC32C(data_block_B)

    This function computes:
        result = CRC32C(data_block_A || data_block_B)

    Args:
        crc32c_result1: The CRC32C checksum of the first data block
        crc32c_result2: The CRC32C checksum of the second data block
        data_length2: The length (in bytes) of the original data that produced crc32c_result2.
                      This is NOT the size of the checksum (which is always 4 bytes),
                      but rather the size of the data block that was checksummed.

    Returns:
        The combined CRC32C checksum as if computed over the concatenated data
    )r	   checksums_crc32c_combine)r   r   r   s      r   combine_crc32cr    @   s    0 ++NNLYYr   crc64nvme_result1crc64nvme_result2c                 0    t        j                  | ||      S )a  
    Combine two CRC64-NVME (CRC64-Rocksoft) checksums computed over separate data blocks.

    This is equivalent to computing the CRC64-NVME of the concatenated data blocks without
    having to re-scan the data.

    Given:
        crc1 = CRC64_NVME(data_block_A)
        crc2 = CRC64_NVME(data_block_B)

    This function computes:
        result = CRC64_NVME(data_block_A || data_block_B)

    Args:
        crc64nvme_result1: The CRC64-NVME checksum of the first data block
        crc64nvme_result2: The CRC64-NVME checksum of the second data block
        data_length2: The length (in bytes) of the original data that produced crc64nvme_result2.
                      This is NOT the size of the checksum (which is always 8 bytes),
                      but rather the size of the data block that was checksummed.

    Returns:
        The combined CRC64-NVME checksum as if computed over the concatenated data
    )r	   checksums_crc64nvme_combine)r!   r"   r   s      r   combine_crc64nvmer%   [   s    0 ../@BSUabbr   c                       e Zd Z fdZeddedd fd       Zeddedd fd       Zeddedd fd       Zedde	e
eef   dede
fd       Zedde	e
eef   dede
fd	       Zedde	e
eef   dede
fd
       Zde	e
eef   fdZde
fdZ xZS )XXHashc                 0    t         |           || _        y )N)super__init___binding)selfbinding	__class__s     r   r*   zXXHash.__init__w   s    r   seedr   c                 @    t        t        j                  |             S )z<
        Generates a new instance of XXHash64 hash.
        r-   )r'   r	   xxhash64_newr/   s    r   new_xxhash64zXXHash.new_xxhash64{   s    
 g224899r   c                 @    t        t        j                  |             S )z>
        Generates a new instance of XXHash3_64 hash.
        r1   )r'   r	   xxhash3_64_newr3   s    r   new_xxhash3_64zXXHash.new_xxhash3_64   s    
 g44T:;;r   c                 @    t        t        j                  |             S )z?
        Generates a new instance of XXHash3_128 hash.
        r1   )r'   r	   xxhash3_128_newr3   s    r   new_xxhash3_128zXXHash.new_xxhash3_128   s    
 g55d;<<r   r   c                 .    t        j                  | |      S )z.
        One-shot compute of xxhash64
        )r	   xxhash64_computer   r/   s     r   compute_xxhash64zXXHash.compute_xxhash64   s    
 ''t44r   c                 .    t        j                  | |      S )z0
        One-shot compute of xxhash3_64
        )r	   xxhash3_64_computer=   s     r   compute_xxhash3_64zXXHash.compute_xxhash3_64   s    
 ))%66r   c                 .    t        j                  | |      S )z1
        One-shot compute of xxhash3_128
        )r	   xxhash3_128_computer=   s     r   compute_xxhash3_128zXXHash.compute_xxhash3_128   s    
 **5$77r   c                 D    t        j                  | j                  |       y)z7
        Updates hash with the provided input.
        N)r	   xxhash_updater+   )r,   r   s     r   updatezXXHash.update   s     	dmmU3r   c                 @    t        j                  | j                        S )z!
        Finalizes hash.
        )r	   xxhash_finalizer+   )r,   s    r   finalizezXXHash.finalize   s     &&t}}55r   r   )__name__
__module____qualname__r*   staticmethodintr4   r7   r:   r   bytes	bytearray
memoryviewr>   rA   rD   rG   rJ   __classcell__)r.   s   @r   r'   r'   v   s4     :3 :x : : <S < < < =c =( = = 5eY
&B C 53 5W\ 5 5 7%y*(D"E 7S 7Y^ 7 7 85	:)E#F 8c 8Z_ 8 84E%J">? 46% 6r   r'   rK   )r	   awscrtr   typingr   rQ   rP   r   r   r   r   r    r%   r'    r   r   <module>rX      s     ! : : :C :<% <# <c <BU B BC BW WS W WPS W6Z3 Z Z3 ZSV Z6c c cTW c\_ c696^ 96r   