ezcrypto – ruby gem for encrypting and decrypting

ezcrypto is a Ruby wrapper around the openssl library which allows you to encrypt and decipher text.

You can install ezcrypto as a gem.

sudo gem install ezcrypto

Contents of file encrypt.rb:

require 'rubygems'
require 'ezcrypto'

key = EzCrypto::Key.with_password('some password', 'some system salt', :algorithm => 'des')
encrypted_text = key.encrypt('This is the text you want to encrypt')

decrypted_text = key.decrypt(encrypted_text)
puts "Here is deciphered text, which was first encrypted and now deciphered: " + decrypted_text

Output:

Here is deciphered text, which was first encrypted and now deciphered: This is the text you want to encrypt
VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Facebook Twitter Email

One Comment to “ezcrypto – ruby gem for encrypting and decrypting”