This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def substitute(art, count) | |
split = art.split "" | |
spaces = split.each_index.select { |i| split[i] == " " } | |
to_alter = spaces.sample(count) | |
to_alter.each { |i| split[i] = "\u2800" } | |
split.join "" | |
end | |
ascii = [" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rmagick' | |
require 'chunky_png' | |
# Simple least significant bit steganography. Hides a message in the | |
# least significant bit of the red channel of the image. | |
# | |
# Requires ImageMagick, Ruby 2.5, rmagick gem, chunky_png gem | |
# | |
# To encode a message: | |
# ruby lsb.rb encode image_file message encdoded_filename |