module ChunkyPNG::Chunk

def self.verify_crc!(type, content, found_crc)

Raises:
  • (ChunkyPNG::CRCMismatch) - An exception is raised if

Parameters:
  • found_crc (Integer) -- The chunk's found CRC value.
  • content (String) -- The chunk's content.
  • type (String) -- The chunk's type.
def self.verify_crc!(type, content, found_crc)
  expected_crc = Zlib.crc32(content, Zlib.crc32(type))
  raise ChunkyPNG::CRCMismatch, "Chuck CRC mismatch!" if found_crc != expected_crc
end