Module: ZSteg::Checker::SteganographyPNG
- Defined in:
- lib/zsteg/checker/steganography_png.rb
Defined Under Namespace
Classes: Result
Constant Summary collapse
- URL =
"https://github.com/pedrooaugusto/steganography-png"
Class Method Summary collapse
Class Method Details
.check_image(image, _params = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# 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 |