DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Quick Two Encryption With ActiveSupport & Ruby On Rails

10.27.2010
| 8806 views |
  • submit to reddit
        
secret = Digest::SHA1.hexdigest("yourpass")
a = ActiveSupport::MessageEncryptor.new(secret)
b = a.encrypt("eh")

c = ActiveSupport::MessageEncryptor.new(secret)
c.decrypt(b)