
    N                     H    S r SSKJr  SSKJr  SSKJr  SSKrSSKrS rS r	g)z)Helpers for calculating CRC32C checksums.    )absolute_import)division)unicode_literalsNc                 x    [         R                  R                  S5      nU" [        R                  " U 5      5      $ )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                 @    U b  [        U 5      U:H  $ [        S5      U:H  $ )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   