module ZSteg::Checker::SteganographyPNG

Constants

URL

Public Class Methods

check_image(image, _params = {}) click to toggle source
# File lib/zsteg/checker/steganography_png.rb, line 24
def self.check_image image, _params = {}
  ls = image.scanlines.last
  data = ls.decoded_bytes
  secret_type_length = data[-1].ord
  return nil if secret_type_length > data.size - 8
  data = data[ -secret_type_length-8 .. -2 ]
  # data.size to prevent "want 8 bytes, got 7" IOStruct warning when secret_type_length == 0
  r = Result.read(data, data.size)
  r.valid? && [r, URL]
end