class CoBreak::Box::Cipher

encoding and decoding algoritmhs

Public Class Methods

coding() click to toggle source
# File lib/cobreak/cobreak.rb, line 21
def self.coding()
  @options = $options
  @options.enc = "" if @options.enc.nil? == true
  @options.dec = "" if @options.dec.nil? == true
  @options.cipher = %w[Base16 Base32 Base64 Ascii85 Binary Cesar]
  if (@options.cipher.include?(@options.enc.capitalize)) or (@options.cipher.include?(@options.dec.capitalize));
    if (File.exists?(@options.algo));
      IO.foreach(@options.algo){|line|
        line.chomp!
        if (@options.cipher?(@options.enc.capitalize))
          CoBreak::Cifrado.cipher(line.to_s)
        end
        if (@options.cipher.include?(@options.dec.capitalize))
          CoBreak::Decifrado.cipher(line.to_s)
        end
      }
    else
      if (@options.cipher.include?(@options.enc.capitalize))
        CoBreak::Cifrado::cipher(@options.enc, @options.algo.to_s)
      end
      if (@options.cipher.include?(@options.dec.capitalize))
        CoBreak::Decifrado::cipher(@options.dec,@options.algo.to_s)
      end
    end
  end
end