scepticulous/crypto-toolbox

View on GitHub
bin/break-vigenere-xor

Summary

Maintainability
Test Coverage
#!/usr/bin/env ruby

require 'crypto-toolbox'
require 'stackprof'

if ARGV[0].nil?
  $stderr.puts "Missing Argument: Ciphertext (hexstring)"
else
  ciphertext = ARGV[0]

StackProf.run(mode: :cpu, out: 'tmp/stackprof-cpu-vigenere-xor.dump') do
  results = Analyzers::VigenereXor.new.analyze(ciphertext)
  unless results.empty?
    puts "[Success] Found valid result(s):"
    puts results.map(&:str)
  end
end

end