Guest User

rc4_decoder.rb

a guest
Nov 25th, 2015
88
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require 'rc4'
  2.  
  3. if ARGV.size != 1
  4.   puts "Usage: #{$0} <key>|<content>\n\n"
  5.   exit 1
  6. end
  7.  
  8. (key, cypher_text) = ARGV[0].split('|')
  9.  
  10. key = key.split('').sort.join
  11.  
  12. rc4 = RC4.new(key)
  13.  
  14. s = cypher_text.scan(/../).collect{|x| [x.hex].pack('C')}.join
  15.  
  16. puts rc4.decrypt(s)
RAW Paste Data