Module: MangaPlus::Api::Utils

Defined in:
lib/manga_plus/api.rb

Class Method Summary collapse

Class Method Details

.decode(image, encryption_key:) ⇒ Object



29
30
31
32
33
# File 'lib/manga_plus/api.rb', line 29

def self.decode(image, encryption_key:)
  key = [encryption_key].pack('H*')
  key_size = key.bytes.size
  image.bytes.map.with_index { |e, i| e ^ key.bytes[i % key_size] }
end