Decrypt a File

Decrypt a File


This code is structured much like the encryption algorithm, so I will focus on the differences between the two. I am using the same algorithm for decryption as used during encryption. As mentioned earlier, you can use any number of encryption algorithms—just be sure to use the corresponding decryption algorithm. Don't forget your password, or else you will have to write your own brute force script if you ever want to see your data again!

The Code

 require 'crypt/blowfish'

 unless ARGV[0]
     puts "Usage: ruby decrypt.rb <Encrypted_filename.ext>"
     puts "Example: ruby decrypt.rb Encrypted_secret.stuff"

 filename ...

Get Wicked Cool Ruby Scripts now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.