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.
Installing ezcrypto as a gem
sudo gem install ezcrypto
ezcrypto sample code
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
One Comment to “ezcrypto – ruby gem for encrypting and decrypting”