module ChunkyPNG::Chunk

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

Raises:
  • (RuntimeError) - An exception is raised if the found CRC value

Parameters:
  • content (Integer) -- The chunk's content.
  • 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