My name is Heath Anderson.
This is my website.

Ruby on Rails Plugin: string_encryption

This is a very simple Ruby on Rails plugin that allows easy encryption of strings. For the sake of simplicity there no customization. The only cipher used is 'des-ede3-cbc' (Triple DES using Cipher Block Chaining) . See my post on encrypting/decrypting a string with Ruby for more information. First install the plugin:

script/plugin install git://

Next we need to add an encryption key as the constant @ENV['STRING_ENCRYPTION_KEY']@. To do this just run

script/generate encryption_key

or you could set


where "somekey" is your key in environment.rb.

Now encryption/decryption is easy.


"Test".encrypt  #=> "NDFkZTc5NDEyNTg1MzdiZPzBrxZz5aoN%0A"


"NDFkZTc5NDEyNTg1MzdiZPzBrxZz5aoN%0A".decrypt  #=> "Test"

Code at Github: