
    N                     H    d Z ddlmZ ddlmZ ddlmZ ddlZddlZd Zd Z	y)z)Helpers for calculating CRC32C checksums.    )absolute_import)division)unicode_literalsNc                 v    t         j                  j                  d      } |t        j                  |             S )zCalculates the CRC32C checksum of the provided data.

  Args:
    data: the bytes over which the checksum should be calculated.

  Returns:
    An int representing the CRC32C checksum of the provided bytes.
  zcrc-32c)crcmod
predefinedmkPredefinedCrcFunsixensure_binary)data
crc32c_funs     ,lib/googlecloudsdk/command_lib/kms/crc32c.pyCrc32cr      s0       33I>*	C%%d+	,,    c                 >    | t        |       |k(  S t        d      |k(  S )a  Checks that the CRC32C checksum of the provided data matches the provided checksum.

  Args:
    data: bytes over which the checksum should be calculated.
    data_crc32c: int checksum against which data's checksum will be compared.

  Returns:
    True iff both checksums match.
  r   )r   )r   data_crc32cs     r   Crc32cMatchesr   &   s0     
	 Tlk! #;+%r   )
__doc__
__future__r   r   r   gcloud_crcmodr   r
   r   r    r   r   <module>r      s#    0 &  '  

-r   