Class: CoBreak::List

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

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ List

all list formats and types



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cobreak/list_all.rb', line 4

def initialize(options)
  all = Array.new
  all << "Base64" << "Base32" << "Base16" << "Ascii85" << "Binary" << "Cesar"
  if (options.list.eql?("cipher"))
    list_cipher = all.map do |type|
      {category: 'Cipher', name: type}
    end
    puts "\n"
    puts " " * 2 + "#{'ID' + ' ' * 3} | #{' ' + 'Name' + ' ' * 27} | #{'Category' + ' ' * 6}"
    puts "=" * 8 + "+" + "=" * 34 + "+" + "=" * 20
    salt = " "
    list_cipher.each_with_index do |cipher, index|
      puts " " * 2 + "#{index + 1}" + " " * 4 + salt + "|" + " " * 2 + "#{cipher[:name].ljust(31)} | #{cipher[:category].ljust(8)}"
      if(index==8)
        salt = ""
      end
    end
  end
  all.clear
  all << "MD4" << "MD5" << "HALF-MD5" << "SHA1" << "DOUBLE-SHA1" << "SHA2-224" << "SHA2-256" << "SHA2-384" << "SHA2-512" << "SHA3-224" << "SHA3-256" << "SHA3-384" << "SHA3-512" << "RIPEMD-160" << "TIGER-160" << "BLAKE2S-128" << "BLAKE2S-160" << "BlAKE2B-160" << "BLAKE2S-224" << "BLAKE2S-256" << "BLAKE2B-256" << "BLAKE2B_384" << "BLAKE2B-512" << "WHIRLPOOL" << "GOST_STREEBOG_256" << "GOST_STREEBOG_256" << "SHAKE-128"
  if (options.list.eql?("digest"))
    list_algorithms = all.map do |type|
      {category: 'Raw-Hash', name: type}
    end
    puts "\n"
    puts " " * 2 + "#{'ID' + ' ' * 3} | #{' ' + 'Name' + ' ' * 27} | #{'Category' + ' ' * 6}"
    puts "=" * 8 + "+" + "=" * 34 + "+" + "=" * 20
    salt = " "
    list_algorithms.each_with_index do |hash, index|
      puts " " * 2 + "#{index + 1}" + " " * 4 + salt + "|" + " " * 2 + "#{hash[:name].ljust(31)} | #{hash[:category].ljust(8)}"
      if(index==8)
        salt = ""
      end
    end
  end
end