How to encyrpt and decrypt data in ruby on rails

AESCrypt is a simple gem to encryption and decryption in ruby on rails. From the readme file.

Installation

Add this line to your application’s Gemfile:

  gem 'aescrypt'

and run bundler

Usage

  message = "top secret message"
  password = "this_is_a_secret_key_that_you_and_only_you_should_know"

Encrypting

  encrypted_data = AESCrypt.encrypt(message, password)

Decrypting

  message = AESCrypt.decrypt(encrypted_data, password)