Class: CoBreak::Box::Cipher

Inherits:
Object
  • Object
show all
Defined in:
lib/cobreak/cobreak_opt.rb

Overview

encoding and decoding algoritmhs

Class Method Summary collapse

Class Method Details

.codingObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/cobreak/cobreak_opt.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