Using string cryptography in Rails

I struggled with this a couple weeks ago for saving Social Security
Numbers and Salaries in the DB encrypted. Not sure how secure this is,
but this is perhaps a start:

In my latest project I needed to encrypt cc numbers. I based my code
on this blog

Nothing needed except the standard ruby library.