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:

http://pastie.caboo.se/125436

In my latest project I needed to encrypt cc numbers. I based my code on this blog http://blog.leetsoft.com/2006/03/14/simple-encryption

Nothing needed except the standard ruby library.