Pueden sugerir arreglos. Espero les sea de utilidad.
# Copyright (C) 2015 B3N <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Description: String to binary converter and viceversa
# Original name: bconverter.rb
# Version: 1.0
#!/usr/bin/env ruby
def help
puts
puts "Usage: #{__FILE__} -s \"String to convert to binary\""
puts " #{__FILE__} -b \"00111011 00101001\""
end
if ARGV.empty? || ARGV.length != 2
puts help
elsif ARGV[0] == '-s'
ARGV[1].unpack("C*").each{|c| print "%08b " % c}
print "\n"
elsif ARGV[0] == '-b'
puts [ARGV[1].delete(' ')].pack("B*")
else
puts
puts "[-] incorrect option: #{ARGV[0]}"
help
puts
end